@eifi1/ui-kit 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/README.md +10 -10
  2. package/dist/components/amount-input.d.ts +17 -1
  3. package/dist/components/amount-input.js +46 -11
  4. package/dist/components/amount-input.js.map +1 -1
  5. package/dist/components/bulk-action-bar.d.ts +10 -2
  6. package/dist/components/bulk-action-bar.js.map +1 -1
  7. package/dist/components/button-group.d.ts +1 -1
  8. package/dist/components/calculator.d.ts +1 -1
  9. package/dist/components/chart.js +14 -8
  10. package/dist/components/chart.js.map +1 -1
  11. package/dist/components/chip.js +20 -15
  12. package/dist/components/chip.js.map +1 -1
  13. package/dist/components/combobox-core.d.ts +3 -1
  14. package/dist/components/combobox-core.js +16 -5
  15. package/dist/components/combobox-core.js.map +1 -1
  16. package/dist/components/combobox.js.map +1 -1
  17. package/dist/components/copy-button.d.ts +1 -1
  18. package/dist/components/data-table-filter-popover.js +8 -1
  19. package/dist/components/data-table-filter-popover.js.map +1 -1
  20. package/dist/components/data-table.js +28 -20
  21. package/dist/components/data-table.js.map +1 -1
  22. package/dist/components/entity-combobox.js +22 -17
  23. package/dist/components/entity-combobox.js.map +1 -1
  24. package/dist/components/error-boundary.d.ts +202 -13
  25. package/dist/components/error-boundary.js +211 -20
  26. package/dist/components/error-boundary.js.map +1 -1
  27. package/dist/components/field-sync.js +90 -83
  28. package/dist/components/field-sync.js.map +1 -1
  29. package/dist/components/file-button.d.ts +1 -1
  30. package/dist/components/file-dropzone.d.ts +1 -1
  31. package/dist/components/form-actions.d.ts +1 -1
  32. package/dist/components/full-bleed-dialog.js +4 -0
  33. package/dist/components/full-bleed-dialog.js.map +1 -1
  34. package/dist/components/hover-menu.js +64 -56
  35. package/dist/components/hover-menu.js.map +1 -1
  36. package/dist/components/list.d.ts +14 -2
  37. package/dist/components/list.js +3 -1
  38. package/dist/components/list.js.map +1 -1
  39. package/dist/components/modal.js.map +1 -1
  40. package/dist/components/multi-entity-combobox.js +23 -17
  41. package/dist/components/multi-entity-combobox.js.map +1 -1
  42. package/dist/components/number-field.d.ts +1 -1
  43. package/dist/components/number-input.d.ts +1 -1
  44. package/dist/components/number-input.js.map +1 -1
  45. package/dist/components/numpad-sheet.d.ts +6 -2
  46. package/dist/components/numpad-sheet.js +3 -2
  47. package/dist/components/numpad-sheet.js.map +1 -1
  48. package/dist/components/page-header.d.ts +35 -6
  49. package/dist/components/page-header.js +7 -1
  50. package/dist/components/page-header.js.map +1 -1
  51. package/dist/components/picker-sheet.js +3 -0
  52. package/dist/components/picker-sheet.js.map +1 -1
  53. package/dist/components/popover.js +3 -0
  54. package/dist/components/popover.js.map +1 -1
  55. package/dist/components/settings-fields.d.ts +1 -1
  56. package/dist/components/signed-amount.d.ts +2 -1
  57. package/dist/components/signed-amount.js +1 -1
  58. package/dist/components/signed-amount.js.map +1 -1
  59. package/dist/components/stat-tile.js +1 -1
  60. package/dist/components/stat-tile.js.map +1 -1
  61. package/dist/components/swipeable-row.js +4 -3
  62. package/dist/components/swipeable-row.js.map +1 -1
  63. package/dist/components/text-link.d.ts +73 -11
  64. package/dist/components/text-link.js +45 -10
  65. package/dist/components/text-link.js.map +1 -1
  66. package/dist/components/text.d.ts +26 -2
  67. package/dist/components/text.js +16 -2
  68. package/dist/components/text.js.map +1 -1
  69. package/dist/components/time-input.d.ts +1 -1
  70. package/dist/components/toggle-group.d.ts +22 -0
  71. package/dist/components/toggle-group.js +8 -8
  72. package/dist/components/toggle-group.js.map +1 -1
  73. package/dist/components/toggle-legend.d.ts +17 -0
  74. package/dist/components/toggle-legend.js +6 -2
  75. package/dist/components/toggle-legend.js.map +1 -1
  76. package/dist/components/tooltip.d.ts +51 -1
  77. package/dist/components/tooltip.js +59 -35
  78. package/dist/components/tooltip.js.map +1 -1
  79. package/dist/components/ui.d.ts +1 -1
  80. package/dist/components/ui.js +166 -28
  81. package/dist/components/ui.js.map +1 -1
  82. package/dist/feedback/feedback-attachment.js +4 -6
  83. package/dist/feedback/feedback-attachment.js.map +1 -1
  84. package/dist/feedback/feedback-dialog.js +5 -3
  85. package/dist/feedback/feedback-dialog.js.map +1 -1
  86. package/dist/feedback/feedback-inbox.js +86 -75
  87. package/dist/feedback/feedback-inbox.js.map +1 -1
  88. package/dist/feedback/feedback-thread.d.ts +43 -3
  89. package/dist/feedback/feedback-thread.js +53 -26
  90. package/dist/feedback/feedback-thread.js.map +1 -1
  91. package/dist/feedback.d.ts +1 -1
  92. package/dist/hooks/use-file-drop.d.ts +1 -1
  93. package/dist/i18n/defaults.d.ts +1 -1
  94. package/dist/i18n/kit-labels.d.ts +1 -1
  95. package/dist/i18n/kit-labels.js.map +1 -1
  96. package/dist/i18n/locales/de-CH-informal.d.ts +1 -1
  97. package/dist/i18n/locales/de-CH.d.ts +1 -1
  98. package/dist/i18n/locales/de-informal.d.ts +1 -1
  99. package/dist/i18n/locales/de.d.ts +1 -1
  100. package/dist/i18n/locales/de.js +9 -1
  101. package/dist/i18n/locales/de.js.map +1 -1
  102. package/dist/i18n/locales/es.d.ts +1 -1
  103. package/dist/i18n/locales/es.js +9 -1
  104. package/dist/i18n/locales/es.js.map +1 -1
  105. package/dist/i18n/locales/fr.d.ts +1 -1
  106. package/dist/i18n/locales/fr.js +9 -1
  107. package/dist/i18n/locales/fr.js.map +1 -1
  108. package/dist/i18n/locales/hu.d.ts +1 -1
  109. package/dist/i18n/locales/hu.js +9 -1
  110. package/dist/i18n/locales/hu.js.map +1 -1
  111. package/dist/i18n/locales/it.d.ts +1 -1
  112. package/dist/i18n/locales/it.js +9 -1
  113. package/dist/i18n/locales/it.js.map +1 -1
  114. package/dist/i18n/locales/zh.d.ts +1 -1
  115. package/dist/i18n/locales/zh.js +9 -1
  116. package/dist/i18n/locales/zh.js.map +1 -1
  117. package/dist/index.d.ts +6 -6
  118. package/dist/{kit-labels-v3biUF1L.d.ts → kit-labels-Mz8zZHIF.d.ts} +102 -3
  119. package/dist/lib/format.d.ts +23 -5
  120. package/dist/lib/format.js +3 -1
  121. package/dist/lib/format.js.map +1 -1
  122. package/dist/rhf/fields.d.ts +57 -15
  123. package/dist/rhf/fields.js +41 -11
  124. package/dist/rhf/fields.js.map +1 -1
  125. package/dist/rhf/form.d.ts +1 -1
  126. package/dist/rhf.d.ts +2 -2
  127. package/dist/rhf.js.map +1 -1
  128. package/dist/search/command-palette.js +20 -14
  129. package/dist/search/command-palette.js.map +1 -1
  130. package/dist/shell/app-shell.d.ts +1 -1
  131. package/dist/shell/app-shell.js +62 -54
  132. package/dist/shell/app-shell.js.map +1 -1
  133. package/dist/shell/top-bar-brand.d.ts +1 -1
  134. package/dist/shell/topbar-action-menu.d.ts +9 -3
  135. package/dist/shell/topbar-action-menu.js +2 -1
  136. package/dist/shell/topbar-action-menu.js.map +1 -1
  137. package/dist/shell.d.ts +1 -1
  138. package/dist/tour/tour.js +10 -4
  139. package/dist/tour/tour.js.map +1 -1
  140. package/dist/wizard/stepper-nav.d.ts +1 -1
  141. package/dist/wizard/use-wizard.js +4 -2
  142. package/dist/wizard/use-wizard.js.map +1 -1
  143. package/dist/wizard/wizard-step.d.ts +11 -1
  144. package/dist/wizard/wizard-step.js +24 -6
  145. package/dist/wizard/wizard-step.js.map +1 -1
  146. package/dist/wizard.d.ts +1 -1
  147. package/package.json +6 -6
  148. package/src/components/amount-input.tsx +97 -10
  149. package/src/components/bulk-action-bar.tsx +16 -3
  150. package/src/components/chart.tsx +19 -8
  151. package/src/components/chip.tsx +6 -0
  152. package/src/components/combobox-core.tsx +28 -9
  153. package/src/components/combobox.tsx +2 -0
  154. package/src/components/data-table-filter-popover.tsx +13 -5
  155. package/src/components/data-table.tsx +6 -0
  156. package/src/components/entity-combobox.tsx +7 -4
  157. package/src/components/error-boundary.tsx +453 -29
  158. package/src/components/field-sync.tsx +48 -40
  159. package/src/components/full-bleed-dialog.tsx +4 -0
  160. package/src/components/hover-menu.tsx +26 -17
  161. package/src/components/list.tsx +17 -3
  162. package/src/components/modal.tsx +4 -0
  163. package/src/components/multi-entity-combobox.tsx +8 -4
  164. package/src/components/number-input.tsx +1 -0
  165. package/src/components/numpad-sheet.tsx +6 -1
  166. package/src/components/page-header.tsx +42 -5
  167. package/src/components/picker-sheet.tsx +3 -0
  168. package/src/components/popover.tsx +3 -0
  169. package/src/components/signed-amount.tsx +12 -3
  170. package/src/components/stat-tile.tsx +3 -1
  171. package/src/components/swipeable-row.tsx +7 -7
  172. package/src/components/text-link.tsx +126 -18
  173. package/src/components/text.tsx +46 -2
  174. package/src/components/toggle-group.tsx +35 -10
  175. package/src/components/toggle-legend.tsx +22 -1
  176. package/src/components/tooltip.tsx +79 -8
  177. package/src/components/ui.tsx +307 -39
  178. package/src/feedback/feedback-attachment.tsx +10 -7
  179. package/src/feedback/feedback-dialog.tsx +7 -4
  180. package/src/feedback/feedback-inbox.tsx +7 -0
  181. package/src/feedback/feedback-thread.tsx +109 -33
  182. package/src/i18n/kit-labels.tsx +16 -0
  183. package/src/i18n/locales/de.ts +8 -0
  184. package/src/i18n/locales/es.ts +8 -0
  185. package/src/i18n/locales/fr.ts +8 -0
  186. package/src/i18n/locales/hu.ts +8 -0
  187. package/src/i18n/locales/it.ts +8 -0
  188. package/src/i18n/locales/zh.ts +8 -0
  189. package/src/lib/format.ts +29 -6
  190. package/src/rhf/fields.tsx +97 -16
  191. package/src/rhf.ts +1 -1
  192. package/src/search/command-palette.tsx +29 -19
  193. package/src/shell/app-shell.tsx +6 -1
  194. package/src/shell/topbar-action-menu.tsx +11 -4
  195. package/src/tour/tour.tsx +16 -5
  196. package/src/wizard/use-wizard.ts +8 -4
  197. package/src/wizard/wizard-step.tsx +38 -6
@@ -1,10 +1,12 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState, useSyncExternalStore } from "react";
3
+ import { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { Paperclip, Send } from "lucide-react";
5
5
  import { cn } from "../lib/cn.js";
6
+ import { formatRelativeTime } from "../lib/format.js";
6
7
  import { Button, EmptyState, Spinner, Textarea } from "../components/ui.js";
7
8
  import { Skeleton } from "../components/skeleton.js";
9
+ import { Tooltip } from "../components/tooltip.js";
8
10
  import { useKitFileLabels, useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
9
11
  import { FeedbackAttachmentField } from "./feedback-attachment.js";
10
12
  const DEFAULT_FEEDBACK_THREAD_LABELS = {
@@ -72,15 +74,15 @@ function FeedbackThread({
72
74
  /* @__PURE__ */ jsxs("header", { className: "mb-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-[var(--text-muted)]", children: [
73
75
  author != null && /* @__PURE__ */ jsx("span", { "data-private": priv, className: "font-medium text-[var(--text-secondary)]", children: author }),
74
76
  message.staff && /* @__PURE__ */ jsx("span", { className: "rounded border border-[var(--border)] bg-[var(--bg-surface)] px-1 text-[10px] font-medium uppercase tracking-wide text-[var(--text-secondary)]", children: labels.staff }),
75
- date && /* @__PURE__ */ jsx(
76
- "time",
77
- {
78
- dateTime: date.toISOString(),
79
- title: new Intl.DateTimeFormat(locale, { dateStyle: "full", timeStyle: "short" }).format(date),
80
- className: "tabular-nums",
81
- children: formatRelativeTime(date, reference, locale)
82
- }
83
- )
77
+ date && // The kit's Tooltip, not a native title: one tooltip look app-wide
78
+ // (keksdose F0 / dev#523).
79
+ /* @__PURE__ */ jsx(Tooltip, { label: new Intl.DateTimeFormat(locale, { dateStyle: "full", timeStyle: "short" }).format(date), children: /* @__PURE__ */ jsx("time", { dateTime: date.toISOString(), className: "tabular-nums", children: formatRelativeTime(date, {
80
+ now: reference,
81
+ locale,
82
+ // Past the kit's day steps it is a date: "2 weeks ago" makes
83
+ // the reader do arithmetic the date already did.
84
+ absoluteAfterDays: 6.5
85
+ }) }) })
84
86
  ] }),
85
87
  message.body && /* @__PURE__ */ jsx(
86
88
  "p",
@@ -137,19 +139,6 @@ function toDate(value) {
137
139
  const date = value instanceof Date ? value : new Date(value);
138
140
  return Number.isNaN(date.getTime()) ? null : date;
139
141
  }
140
- const MINUTE = 6e4;
141
- const HOUR = 60 * MINUTE;
142
- const DAY = 24 * HOUR;
143
- function formatRelativeTime(date, now, locale) {
144
- const diff = date.getTime() - now;
145
- const abs = Math.abs(diff);
146
- const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
147
- if (abs < 45e3) return rtf.format(0, "second");
148
- if (abs < 45 * MINUTE) return rtf.format(Math.round(diff / MINUTE), "minute");
149
- if (abs < 22 * HOUR) return rtf.format(Math.round(diff / HOUR), "hour");
150
- if (abs < 7 * DAY) return rtf.format(Math.round(diff / DAY), "day");
151
- return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
152
- }
153
142
  const noSubscribe = () => () => {
154
143
  };
155
144
  const isApple = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent);
@@ -159,13 +148,50 @@ function FeedbackComposer({
159
148
  attachment,
160
149
  disabledReason,
161
150
  rows = 3,
151
+ placeholder,
152
+ value,
153
+ onValueChange,
154
+ ref,
162
155
  labels: labelsProp,
163
156
  className
164
157
  }) {
165
158
  const labels = useKitLabels("feedbackComposer", DEFAULT_FEEDBACK_COMPOSER_LABELS, labelsProp);
166
- const [draft, setDraft] = useState("");
159
+ const [ownDraft, setOwnDraft] = useState("");
160
+ const controlled = value !== void 0;
161
+ const draft = controlled ? value : ownDraft;
167
162
  const [file, setFile] = useState(null);
168
163
  const root = useRef(null);
164
+ const box = useRef(null);
165
+ const latest = useRef(draft);
166
+ useLayoutEffect(() => {
167
+ latest.current = draft;
168
+ });
169
+ const caret = useRef(null);
170
+ useLayoutEffect(() => {
171
+ const el = box.current;
172
+ if (caret.current === null || !el) return;
173
+ el.focus();
174
+ el.setSelectionRange(caret.current, caret.current);
175
+ caret.current = null;
176
+ });
177
+ const setDraft = (next) => {
178
+ latest.current = next;
179
+ if (!controlled) setOwnDraft(next);
180
+ onValueChange?.(next);
181
+ };
182
+ useImperativeHandle(ref, () => ({
183
+ insertText: (text) => {
184
+ const el = box.current;
185
+ if (!el) return;
186
+ const current = latest.current;
187
+ const pending2 = caret.current;
188
+ const start = Math.min(pending2 ?? el.selectionStart ?? current.length, current.length);
189
+ const end = pending2 ?? Math.max(start, Math.min(el.selectionEnd ?? start, current.length));
190
+ caret.current = start + text.length;
191
+ setDraft(current.slice(0, start) + text + current.slice(end));
192
+ },
193
+ focus: () => box.current?.focus()
194
+ }));
169
195
  const modifier = useSyncExternalStore(
170
196
  noSubscribe,
171
197
  () => isApple() ? "\u2318" : "Ctrl",
@@ -180,7 +206,7 @@ function FeedbackComposer({
180
206
  const sentDraft = draft;
181
207
  const sentFile = file;
182
208
  Promise.resolve(onSend(draft.trim(), file)).then(() => {
183
- setDraft((current) => current === sentDraft ? "" : current);
209
+ if (latest.current === sentDraft) setDraft("");
184
210
  setFile((current) => current === sentFile ? null : current);
185
211
  }).catch(() => {
186
212
  });
@@ -193,7 +219,8 @@ function FeedbackComposer({
193
219
  rows,
194
220
  dir: "auto",
195
221
  "aria-label": labels.field,
196
- placeholder: labels.placeholder,
222
+ ref: box,
223
+ placeholder: placeholder ?? labels.placeholder,
197
224
  value: draft,
198
225
  onChange: (event) => setDraft(event.target.value),
199
226
  onKeyDown: (event) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-thread.tsx"],"sourcesContent":["import { useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Paperclip, Send } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { Button, EmptyState, Spinner, Textarea } from \"../components/ui\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { useKitFileLabels, useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { FeedbackAttachmentField } from \"./feedback-attachment\";\nimport type { FeedbackNoteAttachment } from \"./feedback-inbox\";\nimport type { FeedbackAttachmentLabels } from \"./feedback-dialog\";\n\n/**\n * The conversation under a report: who said what, when, with what attached — and the\n * box to answer in.\n *\n * Both apps had written it by hand. kastlan's feedback page grew a comment list of\n * bordered boxes with `slate-*` literals (feedback-page.tsx, \"keksdose left this\n * unbuilt\"), and keksdose built the same thing a second time for support\n * (support-thread.tsx) with sides, bubbles and a composer that clears only what it\n * sent. This is that second one, generalised: the kit owns the look and the\n * behaviour, the app owns the data, the upload and every word it does not share.\n *\n * **Own vs other** is the caller's per message (`own`), not a comparison the kit makes\n * against a user id: whose message sits at the END side depends on who is reading,\n * and only the app knows that (keksdose's support thread labelled a member's question\n * \"Du\" in the admin panel the first time round, by reading the wrong field).\n *\n * **Redaction.** A thread is somebody's words about their own data — exactly what a\n * host's demo / screen-share mode blurs. Bodies, authors and attachments carry\n * `data-private` (the attribute `Tooltip redact` and `StatTile sensitive` use) unless\n * `redact={false}`.\n *\n * **RTL.** Sides are logical — `justify-end` is the reading end, and the bubble's\n * tucked corner is `rounded-ee` / `rounded-es` — and each body is `dir=\"auto\"`, so a\n * Hebrew reply in an English thread (or the reverse) lays out as its own language.\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/** The `feedbackThread` namespace of `<UiKitProvider labels>`. */\nexport interface FeedbackThreadLabels {\n /** Accessible name of the message list. */\n thread: string;\n empty: string;\n loading: string;\n /** Author line of an `own` message that has no `author` of its own. */\n you: string;\n /** The badge beside a `staff` author. */\n staff: string;\n /** Accessible name of a message's attachment list. */\n attachments: string;\n}\n\nexport const DEFAULT_FEEDBACK_THREAD_LABELS: FeedbackThreadLabels = {\n thread: \"Comments\",\n empty: \"No comments yet\",\n loading: \"Loading comments…\",\n you: \"You\",\n staff: \"Staff\",\n attachments: \"Attachments\",\n};\n\n/** The `feedbackComposer` namespace of `<UiKitProvider labels>`. The attach buttons'\n * words are `feedbackAttachment`'s, shared with the dialog and the note editor. */\nexport interface FeedbackComposerLabels {\n /** Accessible name of the text box. */\n field: string;\n placeholder: string;\n send: string;\n /** The shortcut line, given the platform's modifier (\"Ctrl\" or \"⌘\"). */\n sendHint: (modifier: string) => string;\n}\n\nexport const DEFAULT_FEEDBACK_COMPOSER_LABELS: FeedbackComposerLabels = {\n field: \"Write a comment\",\n placeholder: \"Write a comment…\",\n send: \"Send\",\n sendHint: (modifier) => `${modifier} + Enter to send`,\n};\n\n/* ── Thread ───────────────────────────────────────────────────────────────── */\n\nexport interface FeedbackThreadAttachment {\n id?: string | number;\n name: string;\n /** Where to open it. Left out, the attachment is listed by name only. */\n url?: string;\n /** MIME type; an `image/*` with a `url` is shown as a thumbnail. */\n type?: string;\n /** Bytes, shown beside a non-image. */\n size?: number;\n}\n\nexport interface FeedbackThreadMessage {\n id: string | number;\n /** Who wrote it. Left out on an `own` message, it reads \"You\". */\n author?: ReactNode;\n /** A `Date`, an ISO string or epoch ms. */\n createdAt: Date | string | number;\n body: string;\n attachments?: readonly FeedbackThreadAttachment[];\n /** Written by whoever is reading: sits at the end side, in the brand tint. */\n own?: boolean;\n /** Written by the team rather than a user: gets the \"Staff\" badge. */\n staff?: boolean;\n}\n\nexport interface FeedbackThreadProps {\n messages: readonly FeedbackThreadMessage[];\n loading?: boolean;\n /** Replaces the default \"No comments yet\". */\n empty?: ReactNode;\n /**\n * Draw one attachment yourself — for files behind auth, which a plain `<img src>`\n * cannot fetch (kastlan's `AuthedImage`), or a lightbox. The default is a thumbnail\n * link for an image with a `url`, a file link otherwise.\n */\n renderAttachment?: (attachment: FeedbackThreadAttachment, message: FeedbackThreadMessage) => ReactNode;\n /** Tag bodies, authors and attachments `data-private`. Default true. */\n redact?: boolean;\n /** \"Now\" for the relative times — pin it in tests and stories. Default: the clock. */\n now?: Date | number;\n /** Overrides the provider's locale for the times. */\n locale?: string;\n labels?: Partial<FeedbackThreadLabels>;\n className?: string;\n}\n\nexport function FeedbackThread({\n messages,\n loading = false,\n empty,\n renderAttachment,\n redact = true,\n now,\n locale: localeProp,\n labels: labelsProp,\n className,\n}: FeedbackThreadProps) {\n const labels = useKitLabels(\"feedbackThread\", DEFAULT_FEEDBACK_THREAD_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const file = useKitFileLabels();\n const priv = redact ? \"\" : undefined;\n const clock = useMinuteClock(now === undefined);\n const reference = now === undefined ? clock : +now;\n\n if (loading && messages.length === 0) {\n return <Skeleton lines={3} label={labels.loading} className={className} />;\n }\n if (messages.length === 0) {\n return (\n <EmptyState\n variant=\"inline\"\n size=\"sm\"\n title={empty ?? labels.empty}\n className={cn(\"justify-start\", className)}\n />\n );\n }\n\n return (\n <ol aria-label={labels.thread} aria-busy={loading || undefined} className={cn(\"space-y-3\", className)}>\n {messages.map((message) => {\n const date = toDate(message.createdAt);\n const author = message.author ?? (message.own ? labels.you : null);\n const attachments = message.attachments ?? [];\n return (\n <li\n key={message.id}\n className={cn(\"flex\", message.own ? \"justify-end\" : \"justify-start\")}\n data-own={message.own ? \"\" : undefined}\n >\n <article\n className={cn(\n \"max-w-[85%] min-w-0 rounded-lg px-3 py-2 text-sm\",\n message.own\n ? \"rounded-ee-sm bg-[var(--brand-bg)]\"\n : \"rounded-es-sm bg-[var(--bg-surface-2)]\",\n )}\n >\n <header className=\"mb-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-[var(--text-muted)]\">\n {author != null && (\n <span data-private={priv} className=\"font-medium text-[var(--text-secondary)]\">\n {author}\n </span>\n )}\n {message.staff && (\n <span className=\"rounded border border-[var(--border)] bg-[var(--bg-surface)] px-1 text-[10px] font-medium uppercase tracking-wide text-[var(--text-secondary)]\">\n {labels.staff}\n </span>\n )}\n {date && (\n <time\n dateTime={date.toISOString()}\n title={new Intl.DateTimeFormat(locale, { dateStyle: \"full\", timeStyle: \"short\" }).format(date)}\n className=\"tabular-nums\"\n >\n {formatRelativeTime(date, reference, locale)}\n </time>\n )}\n </header>\n {message.body && (\n <p\n data-private={priv}\n dir=\"auto\"\n className=\"whitespace-pre-wrap break-words text-start text-[var(--text-primary)]\"\n >\n {message.body}\n </p>\n )}\n {attachments.length > 0 && (\n <ul aria-label={labels.attachments} data-private={priv} className=\"mt-2 flex flex-wrap gap-2\">\n {attachments.map((attachment, index) => (\n <li key={attachment.id ?? `${index}-${attachment.name}`} className=\"min-w-0\">\n {renderAttachment ? (\n renderAttachment(attachment, message)\n ) : (\n <DefaultAttachment attachment={attachment} size={file.size} />\n )}\n </li>\n ))}\n </ul>\n )}\n </article>\n </li>\n );\n })}\n </ol>\n );\n}\n\nfunction DefaultAttachment({\n attachment,\n size,\n}: {\n attachment: FeedbackThreadAttachment;\n size: (bytes: number) => string;\n}) {\n const { name, url, type } = attachment;\n if (url && type?.startsWith(\"image/\")) {\n return (\n <a href={url} target=\"_blank\" rel=\"noopener noreferrer\" className=\"block\">\n <img\n src={url}\n alt={name}\n loading=\"lazy\"\n className=\"h-20 w-20 rounded border border-[var(--border)] object-cover\"\n />\n </a>\n );\n }\n const content = (\n <>\n <Paperclip className=\"size-3.5 shrink-0\" aria-hidden />\n <span className=\"truncate\">{name}</span>\n {attachment.size !== undefined && (\n <span className=\"shrink-0 text-[var(--text-muted)]\">{size(attachment.size)}</span>\n )}\n </>\n );\n const chip =\n \"inline-flex max-w-full items-center gap-1 rounded border border-[var(--border)] bg-[var(--bg-surface)] px-2 py-1 text-xs text-[var(--text-secondary)]\";\n return url ? (\n <a href={url} target=\"_blank\" rel=\"noopener noreferrer\" className={cn(chip, \"hover:bg-[var(--bg-hover)]\")}>\n {content}\n </a>\n ) : (\n <span className={chip}>{content}</span>\n );\n}\n\n/** The time, refreshed once a minute while `active`, so \"2 minutes ago\" does not stay\n * \"just now\" on a page left open. Read in state rather than in render, which must be\n * pure. */\nfunction useMinuteClock(active: boolean): number {\n const [time, setTime] = useState(() => Date.now());\n useEffect(() => {\n if (!active) return;\n const id = setInterval(() => setTime(Date.now()), 60_000);\n return () => clearInterval(id);\n }, [active]);\n return time;\n}\n\nfunction toDate(value: Date | string | number): Date | null {\n const date = value instanceof Date ? value : new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\nconst MINUTE = 60_000;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\n\n/**\n * \"just now\", \"5 minutes ago\", \"yesterday\", \"3 days ago\" — `Intl.RelativeTimeFormat`\n * in `locale`, so the grammar is the language's. Past a week it is a date: \"12 days\n * ago\" makes the reader do arithmetic that the date already did. The full date and\n * time are on the `<time>`'s title.\n */\nfunction formatRelativeTime(date: Date, now: number, locale: string | undefined): string {\n const diff = date.getTime() - now;\n const abs = Math.abs(diff);\n const rtf = new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" });\n if (abs < 45_000) return rtf.format(0, \"second\");\n if (abs < 45 * MINUTE) return rtf.format(Math.round(diff / MINUTE), \"minute\");\n if (abs < 22 * HOUR) return rtf.format(Math.round(diff / HOUR), \"hour\");\n if (abs < 7 * DAY) return rtf.format(Math.round(diff / DAY), \"day\");\n return new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" }).format(date);\n}\n\n/* ── Composer ─────────────────────────────────────────────────────────────── */\n\n/** What the composer's attach control takes — {@link FeedbackNoteAttachment} with the\n * labels optional, since the field reads `feedbackAttachment` from the provider. */\nexport type FeedbackComposerAttachment = Omit<FeedbackNoteAttachment, \"labels\"> & {\n labels?: Partial<FeedbackAttachmentLabels>;\n};\n\nexport interface FeedbackComposerProps {\n /**\n * Send the comment. Return the promise: the box clears when it RESOLVES, and only of\n * what was sent — text typed while it was in flight stays. A rejection keeps\n * everything for a retry (surface the error yourself; the composer stays quiet).\n */\n onSend: (body: string, attachment: File | null) => void | Promise<unknown>;\n /** The send is in flight: a spinner on the button and no second send. */\n pending?: boolean;\n /** Offer one picture with the comment (file, paste or `onCaptureScreenshot`).\n * `true` for the defaults. Left out, the composer is text only. */\n attachment?: boolean | FeedbackComposerAttachment;\n /** Rendered INSTEAD of the composer — the thread is closed, or read-only for this\n * reader. */\n disabledReason?: ReactNode;\n rows?: number;\n labels?: Partial<FeedbackComposerLabels>;\n className?: string;\n}\n\nconst noSubscribe = () => () => {};\nconst isApple = () =>\n typeof navigator !== \"undefined\" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent);\n\n/**\n * The answer box under a {@link FeedbackThread}: a textarea, an optional picture,\n * and Send — Ctrl/⌘+Enter sends, the shortcut the report dialog and the note editor\n * use, so the habit carries across the feature. Plain Enter is a new line: feedback is\n * written in paragraphs, unlike a chat.\n */\nexport function FeedbackComposer({\n onSend,\n pending = false,\n attachment,\n disabledReason,\n rows = 3,\n labels: labelsProp,\n className,\n}: FeedbackComposerProps) {\n const labels = useKitLabels(\"feedbackComposer\", DEFAULT_FEEDBACK_COMPOSER_LABELS, labelsProp);\n const [draft, setDraft] = useState(\"\");\n const [file, setFile] = useState<File | null>(null);\n const root = useRef<HTMLDivElement>(null);\n // The server snapshot is \"Ctrl\"; the client corrects it after hydration.\n const modifier = useSyncExternalStore(\n noSubscribe,\n () => (isApple() ? \"⌘\" : \"Ctrl\"),\n () => \"Ctrl\",\n );\n\n if (disabledReason != null && disabledReason !== false) {\n return <p className={cn(\"text-xs text-[var(--text-muted)]\", className)}>{disabledReason}</p>;\n }\n\n const canSend = draft.trim().length > 0 && !pending;\n const send = () => {\n if (!canSend) return;\n const sentDraft = draft;\n const sentFile = file;\n Promise.resolve(onSend(draft.trim(), file))\n .then(() => {\n setDraft((current) => (current === sentDraft ? \"\" : current));\n setFile((current) => (current === sentFile ? null : current));\n })\n .catch(() => {});\n };\n\n const config = attachment === true ? {} : attachment || null;\n\n return (\n <div ref={root} className={cn(\"space-y-2\", className)}>\n <Textarea\n rows={rows}\n dir=\"auto\"\n aria-label={labels.field}\n placeholder={labels.placeholder}\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={(event) => {\n if ((event.ctrlKey || event.metaKey) && event.key === \"Enter\") {\n event.preventDefault();\n send();\n }\n }}\n />\n <div className=\"flex flex-wrap items-end justify-between gap-2\">\n {config ? (\n <FeedbackAttachmentField\n value={file}\n onChange={setFile}\n labels={config.labels}\n accept={config.accept}\n maxBytes={config.maxBytes}\n onError={config.onError}\n onCaptureScreenshot={config.onCaptureScreenshot}\n // The box is this field's sibling; a paste in it bubbles to `root`.\n pasteFrom={root}\n />\n ) : (\n <span />\n )}\n <div className=\"ms-auto flex items-center gap-2\">\n <span className=\"text-xs text-[var(--text-placeholder)]\">{labels.sendHint(modifier)}</span>\n <Button onClick={send} disabled={!canSend} aria-busy={pending || undefined}>\n {pending ? (\n <Spinner label={null} className=\"size-4\" />\n ) : (\n <Send className=\"size-4 rtl:-scale-x-100\" aria-hidden />\n )}\n {labels.send}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";AAmJW,SAyGP,UAzGO,KAiCG,YAjCH;AAnJX,SAAS,WAAW,QAAQ,UAAU,4BAA4B;AAElE,SAAS,WAAW,YAAY;AAChC,SAAS,UAAU;AACnB,SAAS,QAAQ,YAAY,SAAS,gBAAgB;AACtD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB,cAAc,oBAAoB;AAC7D,SAAS,+BAA+B;AA8CjC,MAAM,iCAAuD;AAAA,EAClE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AACf;AAaO,MAAM,mCAA2D;AAAA,EACtE,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,aAAa,GAAG,QAAQ;AACrC;AAkDO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AACF,GAAwB;AACtB,QAAM,SAAS,aAAa,kBAAkB,gCAAgC,UAAU;AACxF,QAAM,SAAS,aAAa,UAAU;AACtC,QAAM,OAAO,iBAAiB;AAC9B,QAAM,OAAO,SAAS,KAAK;AAC3B,QAAM,QAAQ,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;AACpB,eAAK,MAAM,WAAW,MAAM,YAAY,MAAM,QAAQ,SAAS;AAC7D,kBAAM,eAAe;AACrB,iBAAK;AAAA,UACP;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,qBAAC,SAAI,WAAU,kDACZ;AAAA,eACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,UACP,UAAU;AAAA,UACV,QAAQ,OAAO;AAAA,UACf,QAAQ,OAAO;AAAA,UACf,UAAU,OAAO;AAAA,UACjB,SAAS,OAAO;AAAA,UAChB,qBAAqB,OAAO;AAAA,UAE5B,WAAW;AAAA;AAAA,MACb,IAEA,oBAAC,UAAK;AAAA,MAER,qBAAC,SAAI,WAAU,mCACb;AAAA,4BAAC,UAAK,WAAU,0CAA0C,iBAAO,SAAS,QAAQ,GAAE;AAAA,QACpF,qBAAC,UAAO,SAAS,MAAM,UAAU,CAAC,SAAS,aAAW,WAAW,QAC9D;AAAA,oBACC,oBAAC,WAAQ,OAAO,MAAM,WAAU,UAAS,IAEzC,oBAAC,QAAK,WAAU,2BAA0B,eAAW,MAAC;AAAA,UAEvD,OAAO;AAAA,WACV;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-thread.tsx"],"sourcesContent":["import { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { ReactNode, Ref } from \"react\";\nimport { Paperclip, Send } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { formatRelativeTime } from \"../lib/format\";\nimport { Button, EmptyState, Spinner, Textarea } from \"../components/ui\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Tooltip } from \"../components/tooltip\";\nimport { useKitFileLabels, useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { FeedbackAttachmentField } from \"./feedback-attachment\";\nimport type { FeedbackNoteAttachment } from \"./feedback-inbox\";\nimport type { FeedbackAttachmentLabels } from \"./feedback-dialog\";\n\n/**\n * The conversation under a report: who said what, when, with what attached — and the\n * box to answer in.\n *\n * Both apps had written it by hand. kastlan's feedback page grew a comment list of\n * bordered boxes with `slate-*` literals (feedback-page.tsx, \"keksdose left this\n * unbuilt\"), and keksdose built the same thing a second time for support\n * (support-thread.tsx) with sides, bubbles and a composer that clears only what it\n * sent. This is that second one, generalised: the kit owns the look and the\n * behaviour, the app owns the data, the upload and every word it does not share.\n *\n * **Own vs other** is the caller's per message (`own`), not a comparison the kit makes\n * against a user id: whose message sits at the END side depends on who is reading,\n * and only the app knows that (keksdose's support thread labelled a member's question\n * \"Du\" in the admin panel the first time round, by reading the wrong field).\n *\n * **Redaction.** A thread is somebody's words about their own data — exactly what a\n * host's demo / screen-share mode blurs. Bodies, authors and attachments carry\n * `data-private` (the attribute `Tooltip redact` and `StatTile sensitive` use) unless\n * `redact={false}`.\n *\n * **RTL.** Sides are logical — `justify-end` is the reading end, and the bubble's\n * tucked corner is `rounded-ee` / `rounded-es` — and each body is `dir=\"auto\"`, so a\n * Hebrew reply in an English thread (or the reverse) lays out as its own language.\n */\n\n/* ── Labels ───────────────────────────────────────────────────────────────── */\n\n/** The `feedbackThread` namespace of `<UiKitProvider labels>`. */\nexport interface FeedbackThreadLabels {\n /** Accessible name of the message list. */\n thread: string;\n empty: string;\n loading: string;\n /** Author line of an `own` message that has no `author` of its own. */\n you: string;\n /** The badge beside a `staff` author. */\n staff: string;\n /** Accessible name of a message's attachment list. */\n attachments: string;\n}\n\nexport const DEFAULT_FEEDBACK_THREAD_LABELS: FeedbackThreadLabels = {\n thread: \"Comments\",\n empty: \"No comments yet\",\n loading: \"Loading comments…\",\n you: \"You\",\n staff: \"Staff\",\n attachments: \"Attachments\",\n};\n\n/** The `feedbackComposer` namespace of `<UiKitProvider labels>`. The attach buttons'\n * words are `feedbackAttachment`'s, shared with the dialog and the note editor. */\nexport interface FeedbackComposerLabels {\n /** Accessible name of the text box. */\n field: string;\n placeholder: string;\n send: string;\n /** The shortcut line, given the platform's modifier (\"Ctrl\" or \"⌘\"). */\n sendHint: (modifier: string) => string;\n}\n\nexport const DEFAULT_FEEDBACK_COMPOSER_LABELS: FeedbackComposerLabels = {\n field: \"Write a comment\",\n placeholder: \"Write a comment…\",\n send: \"Send\",\n sendHint: (modifier) => `${modifier} + Enter to send`,\n};\n\n/* ── Thread ───────────────────────────────────────────────────────────────── */\n\nexport interface FeedbackThreadAttachment {\n id?: string | number;\n name: string;\n /** Where to open it. Left out, the attachment is listed by name only. */\n url?: string;\n /** MIME type; an `image/*` with a `url` is shown as a thumbnail. */\n type?: string;\n /** Bytes, shown beside a non-image. */\n size?: number;\n}\n\nexport interface FeedbackThreadMessage {\n id: string | number;\n /** Who wrote it. Left out on an `own` message, it reads \"You\". */\n author?: ReactNode;\n /** A `Date`, an ISO string or epoch ms. */\n createdAt: Date | string | number;\n body: string;\n attachments?: readonly FeedbackThreadAttachment[];\n /** Written by whoever is reading: sits at the end side, in the brand tint. */\n own?: boolean;\n /** Written by the team rather than a user: gets the \"Staff\" badge. */\n staff?: boolean;\n}\n\nexport interface FeedbackThreadProps {\n messages: readonly FeedbackThreadMessage[];\n loading?: boolean;\n /** Replaces the default \"No comments yet\". */\n empty?: ReactNode;\n /**\n * Draw one attachment yourself — for files behind auth, which a plain `<img src>`\n * cannot fetch (kastlan's `AuthedImage`), or a lightbox. The default is a thumbnail\n * link for an image with a `url`, a file link otherwise.\n */\n renderAttachment?: (attachment: FeedbackThreadAttachment, message: FeedbackThreadMessage) => ReactNode;\n /** Tag bodies, authors and attachments `data-private`. Default true. */\n redact?: boolean;\n /** \"Now\" for the relative times — pin it in tests and stories. Default: the clock. */\n now?: Date | number;\n /** Overrides the provider's locale for the times. */\n locale?: string;\n labels?: Partial<FeedbackThreadLabels>;\n className?: string;\n}\n\nexport function FeedbackThread({\n messages,\n loading = false,\n empty,\n renderAttachment,\n redact = true,\n now,\n locale: localeProp,\n labels: labelsProp,\n className,\n}: FeedbackThreadProps) {\n const labels = useKitLabels(\"feedbackThread\", DEFAULT_FEEDBACK_THREAD_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const file = useKitFileLabels();\n const priv = redact ? \"\" : undefined;\n const clock = useMinuteClock(now === undefined);\n const reference = now === undefined ? clock : +now;\n\n if (loading && messages.length === 0) {\n return <Skeleton lines={3} label={labels.loading} className={className} />;\n }\n if (messages.length === 0) {\n return (\n <EmptyState\n variant=\"inline\"\n size=\"sm\"\n title={empty ?? labels.empty}\n className={cn(\"justify-start\", className)}\n />\n );\n }\n\n return (\n <ol aria-label={labels.thread} aria-busy={loading || undefined} className={cn(\"space-y-3\", className)}>\n {messages.map((message) => {\n const date = toDate(message.createdAt);\n const author = message.author ?? (message.own ? labels.you : null);\n const attachments = message.attachments ?? [];\n return (\n <li\n key={message.id}\n className={cn(\"flex\", message.own ? \"justify-end\" : \"justify-start\")}\n data-own={message.own ? \"\" : undefined}\n >\n <article\n className={cn(\n \"max-w-[85%] min-w-0 rounded-lg px-3 py-2 text-sm\",\n message.own\n ? \"rounded-ee-sm bg-[var(--brand-bg)]\"\n : \"rounded-es-sm bg-[var(--bg-surface-2)]\",\n )}\n >\n <header className=\"mb-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-[var(--text-muted)]\">\n {author != null && (\n <span data-private={priv} className=\"font-medium text-[var(--text-secondary)]\">\n {author}\n </span>\n )}\n {message.staff && (\n <span className=\"rounded border border-[var(--border)] bg-[var(--bg-surface)] px-1 text-[10px] font-medium uppercase tracking-wide text-[var(--text-secondary)]\">\n {labels.staff}\n </span>\n )}\n {date && (\n // The kit's Tooltip, not a native title: one tooltip look app-wide\n // (keksdose F0 / dev#523).\n <Tooltip label={new Intl.DateTimeFormat(locale, { dateStyle: \"full\", timeStyle: \"short\" }).format(date)}>\n <time dateTime={date.toISOString()} className=\"tabular-nums\">\n {formatRelativeTime(date, {\n now: reference,\n locale,\n // Past the kit's day steps it is a date: \"2 weeks ago\" makes\n // the reader do arithmetic the date already did.\n absoluteAfterDays: 6.5,\n })}\n </time>\n </Tooltip>\n )}\n </header>\n {message.body && (\n <p\n data-private={priv}\n dir=\"auto\"\n className=\"whitespace-pre-wrap break-words text-start text-[var(--text-primary)]\"\n >\n {message.body}\n </p>\n )}\n {attachments.length > 0 && (\n <ul aria-label={labels.attachments} data-private={priv} className=\"mt-2 flex flex-wrap gap-2\">\n {attachments.map((attachment, index) => (\n <li key={attachment.id ?? `${index}-${attachment.name}`} className=\"min-w-0\">\n {renderAttachment ? (\n renderAttachment(attachment, message)\n ) : (\n <DefaultAttachment attachment={attachment} size={file.size} />\n )}\n </li>\n ))}\n </ul>\n )}\n </article>\n </li>\n );\n })}\n </ol>\n );\n}\n\nfunction DefaultAttachment({\n attachment,\n size,\n}: {\n attachment: FeedbackThreadAttachment;\n size: (bytes: number) => string;\n}) {\n const { name, url, type } = attachment;\n if (url && type?.startsWith(\"image/\")) {\n return (\n <a href={url} target=\"_blank\" rel=\"noopener noreferrer\" className=\"block\">\n <img\n src={url}\n alt={name}\n loading=\"lazy\"\n className=\"h-20 w-20 rounded border border-[var(--border)] object-cover\"\n />\n </a>\n );\n }\n const content = (\n <>\n <Paperclip className=\"size-3.5 shrink-0\" aria-hidden />\n <span className=\"truncate\">{name}</span>\n {attachment.size !== undefined && (\n <span className=\"shrink-0 text-[var(--text-muted)]\">{size(attachment.size)}</span>\n )}\n </>\n );\n const chip =\n \"inline-flex max-w-full items-center gap-1 rounded border border-[var(--border)] bg-[var(--bg-surface)] px-2 py-1 text-xs text-[var(--text-secondary)]\";\n return url ? (\n <a href={url} target=\"_blank\" rel=\"noopener noreferrer\" className={cn(chip, \"hover:bg-[var(--bg-hover)]\")}>\n {content}\n </a>\n ) : (\n <span className={chip}>{content}</span>\n );\n}\n\n/** The time, refreshed once a minute while `active`, so \"2 minutes ago\" does not stay\n * \"just now\" on a page left open. Read in state rather than in render, which must be\n * pure. */\nfunction useMinuteClock(active: boolean): number {\n const [time, setTime] = useState(() => Date.now());\n useEffect(() => {\n if (!active) return;\n const id = setInterval(() => setTime(Date.now()), 60_000);\n return () => clearInterval(id);\n }, [active]);\n return time;\n}\n\nfunction toDate(value: Date | string | number): Date | null {\n const date = value instanceof Date ? value : new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\n/* ── Composer ─────────────────────────────────────────────────────────────── */\n\n/** What the composer's attach control takes — {@link FeedbackNoteAttachment} with the\n * labels optional, since the field reads `feedbackAttachment` from the provider. */\nexport type FeedbackComposerAttachment = Omit<FeedbackNoteAttachment, \"labels\"> & {\n labels?: Partial<FeedbackAttachmentLabels>;\n};\n\nexport interface FeedbackComposerProps {\n /**\n * Send the comment. Return the promise: the box clears when it RESOLVES, and only of\n * what was sent — text typed while it was in flight stays. A rejection keeps\n * everything for a retry (surface the error yourself; the composer stays quiet).\n */\n onSend: (body: string, attachment: File | null) => void | Promise<unknown>;\n /** The send is in flight: a spinner on the button and no second send. */\n pending?: boolean;\n /** Offer one picture with the comment (file, paste or `onCaptureScreenshot`).\n * `true` for the defaults. Left out, the composer is text only. */\n attachment?: boolean | FeedbackComposerAttachment;\n /** Rendered INSTEAD of the composer — the thread is closed, or read-only for this\n * reader. */\n disabledReason?: ReactNode;\n rows?: number;\n /**\n * The box's hint, over the `placeholder` label — keksdose F9: an admin answering a\n * support ticket is asked something else (\"Reply to Anna…\") than a member adding to\n * their own report, and one provider-wide label cannot say both.\n */\n placeholder?: string;\n /**\n * The draft, controlled — for a host that keeps it itself (saves it per ticket,\n * prefills a template). Left out, the composer keeps its own. Either way a send\n * that resolves clears only what was sent: controlled, that is an\n * `onValueChange(\"\")` the host receives like any keystroke, and only if the draft\n * is still the one that went out.\n */\n value?: string;\n /** Every change to the draft — typing, {@link FeedbackComposerHandle.insertText}, the\n * clear after a send. Required to change a controlled `value`. */\n onValueChange?: (value: string) => void;\n /** {@link FeedbackComposerHandle}: put text into the draft from outside (canned-reply\n * chips) or focus the box. */\n ref?: Ref<FeedbackComposerHandle>;\n labels?: Partial<FeedbackComposerLabels>;\n className?: string;\n}\n\n/**\n * What a {@link FeedbackComposer} `ref` holds.\n *\n * keksdose F9: the support admin answers the same five questions all day and wants\n * chips above the box (\"Thanks, fixed in the next release\") that drop their text in\n * where the caret is. A controlled `value` alone cannot do that well — the host sees\n * the string, not the caret, so it could only append — so the composer, which owns\n * the textarea, does the splice.\n */\nexport interface FeedbackComposerHandle {\n /**\n * Insert `text` at the caret, replacing any selection (the caret the box last had:\n * a click on a chip blurs it, and the selection survives the blur), then focus the\n * box with the caret after the inserted text so the reply can go on. Nothing is\n * added around it — put a space or a newline in `text` if the reply needs one. A\n * no-op while `disabledReason` replaces the box.\n */\n insertText: (text: string) => void;\n focus: () => void;\n}\n\nconst noSubscribe = () => () => {};\nconst isApple = () =>\n typeof navigator !== \"undefined\" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent);\n\n/**\n * The answer box under a {@link FeedbackThread}: a textarea, an optional picture,\n * and Send — Ctrl/⌘+Enter sends, the shortcut the report dialog and the note editor\n * use, so the habit carries across the feature. Plain Enter is a new line: feedback is\n * written in paragraphs, unlike a chat.\n */\nexport function FeedbackComposer({\n onSend,\n pending = false,\n attachment,\n disabledReason,\n rows = 3,\n placeholder,\n value,\n onValueChange,\n ref,\n labels: labelsProp,\n className,\n}: FeedbackComposerProps) {\n const labels = useKitLabels(\"feedbackComposer\", DEFAULT_FEEDBACK_COMPOSER_LABELS, labelsProp);\n const [ownDraft, setOwnDraft] = useState(\"\");\n const controlled = value !== undefined;\n const draft = controlled ? value : ownDraft;\n const [file, setFile] = useState<File | null>(null);\n const root = useRef<HTMLDivElement>(null);\n const box = useRef<HTMLTextAreaElement>(null);\n // The draft as of the last commit. The send's `.then` and `insertText` run after\n // renders their closure did not see — text typed while the send was in flight, a\n // second chip clicked before the first one's render — and must not act on a stale\n // string (for a controlled draft there is no updater function to lean on).\n const latest = useRef(draft);\n useLayoutEffect(() => {\n latest.current = draft;\n });\n // Where the caret goes once an inserted text has rendered.\n const caret = useRef<number | null>(null);\n useLayoutEffect(() => {\n const el = box.current;\n if (caret.current === null || !el) return;\n el.focus();\n el.setSelectionRange(caret.current, caret.current);\n caret.current = null;\n });\n\n const setDraft = (next: string) => {\n latest.current = next;\n if (!controlled) setOwnDraft(next);\n onValueChange?.(next);\n };\n\n useImperativeHandle(ref, () => ({\n insertText: (text) => {\n const el = box.current;\n if (!el) return;\n const current = latest.current;\n // A second insert before the first has rendered goes after the first, not at the\n // textarea's not-yet-moved caret. Otherwise the textarea's selection, which may\n // be past the end of a controlled value the host has just shortened: clamp it.\n const pending = caret.current;\n const start = Math.min(pending ?? el.selectionStart ?? current.length, current.length);\n const end = pending ?? Math.max(start, Math.min(el.selectionEnd ?? start, current.length));\n caret.current = start + text.length;\n setDraft(current.slice(0, start) + text + current.slice(end));\n },\n focus: () => box.current?.focus(),\n }));\n // The server snapshot is \"Ctrl\"; the client corrects it after hydration.\n const modifier = useSyncExternalStore(\n noSubscribe,\n () => (isApple() ? \"⌘\" : \"Ctrl\"),\n () => \"Ctrl\",\n );\n\n if (disabledReason != null && disabledReason !== false) {\n return <p className={cn(\"text-xs text-[var(--text-muted)]\", className)}>{disabledReason}</p>;\n }\n\n const canSend = draft.trim().length > 0 && !pending;\n const send = () => {\n if (!canSend) return;\n const sentDraft = draft;\n const sentFile = file;\n Promise.resolve(onSend(draft.trim(), file))\n .then(() => {\n if (latest.current === sentDraft) setDraft(\"\");\n setFile((current) => (current === sentFile ? null : current));\n })\n .catch(() => {});\n };\n\n const config = attachment === true ? {} : attachment || null;\n\n return (\n <div ref={root} className={cn(\"space-y-2\", className)}>\n <Textarea\n rows={rows}\n dir=\"auto\"\n aria-label={labels.field}\n ref={box}\n placeholder={placeholder ?? labels.placeholder}\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={(event) => {\n if ((event.ctrlKey || event.metaKey) && event.key === \"Enter\") {\n event.preventDefault();\n send();\n }\n }}\n />\n <div className=\"flex flex-wrap items-end justify-between gap-2\">\n {config ? (\n <FeedbackAttachmentField\n value={file}\n onChange={setFile}\n labels={config.labels}\n accept={config.accept}\n maxBytes={config.maxBytes}\n onError={config.onError}\n onCaptureScreenshot={config.onCaptureScreenshot}\n // The box is this field's sibling; a paste in it bubbles to `root`.\n pasteFrom={root}\n />\n ) : (\n <span />\n )}\n <div className=\"ms-auto flex items-center gap-2\">\n <span className=\"text-xs text-[var(--text-placeholder)]\">{labels.sendHint(modifier)}</span>\n <Button onClick={send} disabled={!canSend} aria-busy={pending || undefined}>\n {pending ? (\n <Spinner label={null} className=\"size-4\" />\n ) : (\n <Send className=\"size-4 rtl:-scale-x-100\" aria-hidden />\n )}\n {labels.send}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";AAqJW,SA+GP,UA/GO,KAiCG,YAjCH;AArJX,SAAS,WAAW,qBAAqB,iBAAiB,QAAQ,UAAU,4BAA4B;AAExG,SAAS,WAAW,YAAY;AAChC,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,QAAQ,YAAY,SAAS,gBAAgB;AACtD,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,kBAAkB,cAAc,oBAAoB;AAC7D,SAAS,+BAA+B;AA8CjC,MAAM,iCAAuD;AAAA,EAClE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AACf;AAaO,MAAM,mCAA2D;AAAA,EACtE,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,aAAa,GAAG,QAAQ;AACrC;AAkDO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AACF,GAAwB;AACtB,QAAM,SAAS,aAAa,kBAAkB,gCAAgC,UAAU;AACxF,QAAM,SAAS,aAAa,UA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C;AAAA,UAEvD,OAAO;AAAA,WACV;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["pending"]}
@@ -1,6 +1,6 @@
1
1
  export { DEFAULT_ATTACHMENT_ACCEPT, DEFAULT_FEEDBACK_ATTACHMENT_LABELS, DEFAULT_MAX_ATTACHMENT_BYTES, FeedbackAttachmentField, FeedbackAttachmentFieldLabels, pastedName } from './feedback/feedback-attachment.js';
2
2
  export { DEFAULT_FEEDBACK_DIALOG_LABELS, FeedbackAttachmentLabels, FeedbackCategoryOption, FeedbackDialog, FeedbackDialogLabels, FeedbackDialogTextLabels, FeedbackSubmission } from './feedback/feedback-dialog.js';
3
3
  export { FEEDBACK_CATEGORY_META, FEEDBACK_CATEGORY_ORDER, FEEDBACK_STATUS_META, FEEDBACK_STATUS_ORDER, FeedbackCategory, FeedbackCategoryBadge, FeedbackDetail, FeedbackDetailSection, FeedbackNoteAttachment, FeedbackNoteEditor, FeedbackProse, FeedbackStatus, FeedbackStatusBadge, FeedbackStatusTransitions, feedbackCategoryRank, nextFeedbackStatus, selectableFeedbackStatuses, visibleFeedbackStatuses } from './feedback/feedback-inbox.js';
4
- export { DEFAULT_FEEDBACK_COMPOSER_LABELS, DEFAULT_FEEDBACK_THREAD_LABELS, FeedbackComposer, FeedbackComposerAttachment, FeedbackComposerLabels, FeedbackComposerProps, FeedbackThread, FeedbackThreadAttachment, FeedbackThreadLabels, FeedbackThreadMessage, FeedbackThreadProps } from './feedback/feedback-thread.js';
4
+ export { DEFAULT_FEEDBACK_COMPOSER_LABELS, DEFAULT_FEEDBACK_THREAD_LABELS, FeedbackComposer, FeedbackComposerAttachment, FeedbackComposerHandle, FeedbackComposerLabels, FeedbackComposerProps, FeedbackThread, FeedbackThreadAttachment, FeedbackThreadLabels, FeedbackThreadMessage, FeedbackThreadProps } from './feedback/feedback-thread.js';
5
5
  import 'react';
6
6
  import 'lucide-react';
@@ -1,5 +1,5 @@
1
1
  import { DragEvent, ReactElement } from 'react';
2
- import { aW as UseFilePickerOptions } from '../kit-labels-v3biUF1L.js';
2
+ import { aY as UseFilePickerOptions } from '../kit-labels-Mz8zZHIF.js';
3
3
  import '../components/data-table-labels.js';
4
4
  import '../components/mini-calendar.js';
5
5
  import '../components/calendar-heatmap.js';
@@ -1,4 +1,4 @@
1
- import { aT as UiKitLabels } from '../kit-labels-v3biUF1L.js';
1
+ import { aV as UiKitLabels } from '../kit-labels-Mz8zZHIF.js';
2
2
  import 'react';
3
3
  import '../components/data-table-labels.js';
4
4
  import '../components/mini-calendar.js';
@@ -5,7 +5,7 @@ import '../components/calendar-heatmap.js';
5
5
  import '../components/popover.js';
6
6
  import '../components/chip.js';
7
7
  import '../components/field-sync.js';
8
- export { A as AppShellLabels, C as CalculatorLabels, v as ComboboxLabels, w as CommonLabels, D as CurrencyLabels, E as DEFAULT_APP_SHELL_LABELS, F as DEFAULT_CALCULATOR_LABELS, G as DEFAULT_COMBOBOX_LABELS, H as DEFAULT_COMMON_LABELS, J as DEFAULT_CURRENCY_LABELS, K as DEFAULT_DATE_PICKER_LABELS, L as DEFAULT_FILE_LABELS, O as DEFAULT_MULTI_SELECT_LABELS, Q as DEFAULT_PICKER_SHEET_LABELS, R as DEFAULT_SWIPEABLE_ROW_LABELS, T as DEFAULT_TOP_BAR_LABELS, U as DatePickerLabels, ac as FileLabels, ax as KitLinkComponent, ay as KitLinkProps, aA as LabelOverride, aC as MultiSelectLabels, aF as PickerSheetLabels, aK as SwipeableRowLabels, aR as TopBarLabels, aS as UiKitLabelOverrides, aT as UiKitLabels, aU as UiKitProvider, aV as UiKitProviderProps, aZ as formatFileSize, a$ as missingKitLabels, b2 as useKitFileLabels, b3 as useKitLabelOverrides, b4 as useKitLabels, b5 as useKitLink, b6 as useKitLocale, b7 as useKitWeekStart } from '../kit-labels-v3biUF1L.js';
8
+ export { A as AppShellLabels, C as CalculatorLabels, v as ComboboxLabels, w as CommonLabels, D as CurrencyLabels, E as DEFAULT_APP_SHELL_LABELS, F as DEFAULT_CALCULATOR_LABELS, G as DEFAULT_COMBOBOX_LABELS, H as DEFAULT_COMMON_LABELS, J as DEFAULT_CURRENCY_LABELS, K as DEFAULT_DATE_PICKER_LABELS, L as DEFAULT_FILE_LABELS, O as DEFAULT_MULTI_SELECT_LABELS, Q as DEFAULT_PICKER_SHEET_LABELS, R as DEFAULT_SWIPEABLE_ROW_LABELS, T as DEFAULT_TOP_BAR_LABELS, U as DatePickerLabels, ac as FileLabels, az as KitLinkComponent, aA as KitLinkProps, aC as LabelOverride, aE as MultiSelectLabels, aH as PickerSheetLabels, aM as SwipeableRowLabels, aT as TopBarLabels, aU as UiKitLabelOverrides, aV as UiKitLabels, aW as UiKitProvider, aX as UiKitProviderProps, a$ as formatFileSize, b1 as missingKitLabels, b4 as useKitFileLabels, b5 as useKitLabelOverrides, b6 as useKitLabels, b7 as useKitLink, b8 as useKitLocale, b9 as useKitWeekStart } from '../kit-labels-Mz8zZHIF.js';
9
9
  import '../wizard/types.js';
10
10
  import '../tour/tour.js';
11
11
  import '../search/command-palette.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/i18n/kit-labels.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\nimport type { AnchorHTMLAttributes, ReactElement, Ref } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { DataTableLabels } from \"../components/data-table-labels\";\nimport type { MiniCalendarLabels, WeekDay } from \"../components/mini-calendar\";\nimport type { CalendarHeatmapLabels } from \"../components/calendar-heatmap\";\nimport type { PopoverLabels } from \"../components/popover\";\nimport type { ChipInputLabels } from \"../components/chip\";\nimport type { FieldSyncLabels } from \"../components/field-sync\";\nimport type { PasswordRevealLabels, TabsLabels } from \"../components/ui\";\nimport type { WizardLabels } from \"../wizard/types\";\nimport type { TourLabels } from \"../tour/tour\";\nimport type { CommandPaletteLabels } from \"../search/command-palette\";\nimport type { GlobalSearchLabels } from \"../search/global-search\";\nimport type { MonthPickerLabels } from \"../components/month-picker\";\nimport type { PageContentsLabels } from \"../components/page-contents\";\nimport type { SeriesChartLabels } from \"../components/series-chart-labels\";\nimport type { PieChartLabels } from \"../components/pie-chart-labels\";\nimport type { SparklineLabels } from \"../components/sparkline\";\nimport type { StatTileLabels } from \"../components/stat-tile\";\nimport type { SignaturePadLabels } from \"../components/signature-pad\";\nimport type { PasswordStrengthLabels } from \"../components/password-strength\";\nimport type { DangerConfirmLabels } from \"../components/danger-confirm\";\nimport type { SwatchPickerLabels } from \"../components/swatch-picker\";\nimport type { IconPickerLabels } from \"../components/icon-picker\";\nimport type { DialogFrameLabels } from \"../components/dialog-frame\";\nimport type { FilePickerLabels } from \"../components/file-button\";\nimport type { MeasuredGridLabels } from \"../components/measured-grid\";\nimport type { FeedbackAttachmentFieldLabels } from \"../feedback/feedback-attachment\";\nimport type { FeedbackDialogTextLabels } from \"../feedback/feedback-dialog\";\nimport type { FeedbackComposerLabels, FeedbackThreadLabels } from \"../feedback/feedback-thread\";\nimport type { AccountSettingsLabels } from \"../components/account-settings-labels\";\nimport type { ConfirmDialogLabels } from \"../components/confirm-dialog\";\nimport type { FloatingPanelLabels } from \"../components/floating-panel\";\nimport type { CopyButtonLabels } from \"../components/copy-button\";\nimport type { BulkActionBarLabels } from \"../components/bulk-action-bar\";\nimport type { ListLabels } from \"../components/list\";\nimport type { BreadcrumbsLabels } from \"../components/breadcrumbs\";\nimport type { ToastLabels } from \"../components/toast\";\nimport type { FormActionsLabels } from \"../components/form-actions\";\nimport type { DescriptionListLabels } from \"../components/description-list\";\nimport type { LineItemsLabels } from \"../components/line-items\";\nimport type { ProgressBarLabels } from \"../components/progress-bar\";\nimport type { SignedAmountLabels } from \"../components/signed-amount\";\nimport type { ErrorBoundaryLabels } from \"../components/error-boundary\";\nimport type { AuthedImageLabels } from \"../components/authed-image\";\nimport type { ImageGridLabels } from \"../components/image-grid\";\nimport type { LightboxLabels } from \"../components/lightbox\";\n\n/**\n * EVERY string the kit renders, as one typed tree — and an optional provider that\n * hands it to every component at once.\n *\n * WHY THIS EXISTS. The kit ships no catalogue and resolves no strings, and that stays\n * true: the app supplies every word. What was wrong was HOW it had to supply them —\n * one `labels` prop per component instance, under a different prop name per\n * component (`labels`, `calendarLabels`, `passwordLabels`, `clearLabel`,\n * `searchPlaceholder`, `ariaLabel` …). A translated app therefore rendered English\n * wherever one call site forgot one prop, and nothing told it so: a German showcase\n * still said \"Rows per page\", \"Collapse sidebar\" and \"Popover\" in seven languages.\n *\n * Now there is one key per string, addressed by a dot path (`dataTable.pageSize`,\n * `datePicker.today`), and three sources in a fixed order of precedence:\n *\n * the component's own prop > <UiKitProvider labels> > English default\n *\n * A consumer writes its translation ONCE, as a `UiKitLabels` (or a partial of it),\n * mounts `<UiKitProvider labels={…} locale={…}>` at the root, and every kit component\n * below speaks that language — including the ones nested inside other kit components\n * (the calendar inside the data table's date filter, the popover inside the date\n * picker), which no prop at the outer call site could reach before.\n *\n * Messages that carry a value are FUNCTIONS of that value, never a template to fill:\n * a number glued into an English sentence is untranslatable, because the grammar\n * around it moves with it in most languages.\n */\n\n/* ── Namespaces that had no labels type of their own ─────────────────────── */\n\n/** The words several components share. A component's own namespace wins over these\n * where both exist; these are what a new component reaches for first. */\nexport interface CommonLabels {\n close: string;\n clear: string;\n search: string;\n done: string;\n cancel: string;\n save: string;\n back: string;\n next: string;\n remove: string;\n loading: string;\n noResults: string;\n /** \"Name: value\" — how a field's accessible name is composed with its value.\n * A colon-and-space is not universal punctuation (French puts a space before\n * the colon, Chinese uses a full-width one). */\n fieldValue: (field: string, value: string) => string;\n /** The × that puts away a banner or a notice (`AlertBanner onDismiss`). Not `close`:\n * nothing opened, and \"Close\" on a banner reads as closing the page it sits on. */\n dismiss: string;\n /** Read after a link that opens a new tab (`<Button href external>`, TextLink):\n * nothing else tells a screen reader the page is about to change tabs. */\n opensInNewTab: string;\n}\n\n/** `DatePicker` / `DateRangePicker` chrome. The calendar inside has its own\n * namespace, `miniCalendar`. */\nexport interface DatePickerLabels {\n /** Accessible name of the popover panel the calendar opens in. */\n panel: string;\n /** The same, for `DateRangePicker`'s panel. */\n rangePanel: string;\n clear: string;\n previousDay: string;\n nextDay: string;\n today: string;\n /** `DateRangePicker commit=\"apply\"`: the button that commits the drafted range. */\n apply: string;\n /** …and the one that discards it. */\n cancel: string;\n /** Accessible name of `DateRangePicker`'s preset column. */\n presets: string;\n}\n\n/** The whole combobox family: `Combobox`, `EntityCombobox`,\n * `MultiEntityCombobox`, `InlineEntityCombobox`, `Autocomplete`. */\nexport interface ComboboxLabels {\n search: string;\n noResults: string;\n clear: string;\n loading: string;\n /** The \"add this\" row when free entry is allowed. */\n create: (query: string) => string;\n /** Trigger summary once more than one value is picked. */\n selectedCount: (count: number) => string;\n /** An async lookup (`loadOptions`) failed. */\n loadError: string;\n /** Announced (live region) when the list settles on `count` > 0 rows. */\n resultCount: (count: number) => string;\n /** The query is shorter than the `minChars` a lookup needs. */\n minChars: (count: number) => string;\n}\n\nexport interface MultiSelectLabels {\n search: string;\n selectAll: string;\n clear: string;\n /** Trigger text when nothing is picked, which a multi-select reads as \"all\". */\n all: string;\n /** Trigger summary once some (but not all) values are picked. The English\n * default is the bare count, which is what the trigger has always shown. */\n selectedCount: (count: number) => string;\n}\n\n/** `CalculatorButton` (desktop popover keypad) and `NumberPadSheet` (phone sheet). */\nexport interface CalculatorLabels {\n /** The button that opens the calculator. */\n open: string;\n /** The popover / sheet itself. */\n panel: string;\n calculation: string;\n backspace: string;\n clear: string;\n equals: string;\n /** The primary key of the phone pad — visible text, not an aria-label. */\n done: string;\n /** Names of the operator keys and the decimal key. Their glyphs are not names a\n * screen reader agrees on — \"÷\" is read as \"division sign\", \"divided by\" or\n * nothing at all depending on the reader — so each says what it does. */\n plus: string;\n minus: string;\n times: string;\n divide: string;\n decimal: string;\n}\n\n/** `CurrencySelect` and the currency half of `AmountInput`. */\nexport interface CurrencyLabels {\n currency: string;\n search: string;\n}\n\nexport interface AppShellLabels {\n collapse: string;\n expand: string;\n /** Accessible name of an inline group's disclosure button (`subNav=\"inline\"`). */\n toggleGroup: (groupLabel: string) => string;\n}\n\nexport interface TopBarLabels {\n theme: string;\n palette: string;\n language: string;\n switchRole: string;\n /** The role switcher's tooltip, given the active role's name. */\n role: (value: string) => string;\n}\n\nexport interface PickerSheetLabels {\n close: string;\n}\n\nexport interface SwipeableRowLabels {\n actions: string;\n}\n\nexport interface FileLabels {\n /** A file size for display, given its size in BYTES. The default uses\n * `Intl.NumberFormat`'s unit formatting in the provider's locale. */\n size: (bytes: number) => string;\n}\n\n/** The complete tree. `UiKitProvider` takes any partial of it. */\nexport interface UiKitLabels {\n common: CommonLabels;\n dataTable: DataTableLabels;\n miniCalendar: MiniCalendarLabels;\n calendarHeatmap: CalendarHeatmapLabels;\n datePicker: DatePickerLabels;\n monthPicker: MonthPickerLabels;\n popover: PopoverLabels;\n combobox: ComboboxLabels;\n multiSelect: MultiSelectLabels;\n calculator: CalculatorLabels;\n currency: CurrencyLabels;\n chipInput: ChipInputLabels;\n fieldSync: FieldSyncLabels;\n passwordReveal: PasswordRevealLabels;\n tabs: TabsLabels;\n appShell: AppShellLabels;\n pageContents: PageContentsLabels;\n topBar: TopBarLabels;\n pickerSheet: PickerSheetLabels;\n swipeableRow: SwipeableRowLabels;\n file: FileLabels;\n wizard: WizardLabels;\n tour: TourLabels;\n commandPalette: CommandPaletteLabels;\n globalSearch: GlobalSearchLabels;\n seriesChart: SeriesChartLabels;\n pieChart: PieChartLabels;\n sparkline: SparklineLabels;\n statTile: StatTileLabels;\n signaturePad: SignaturePadLabels;\n passwordStrength: PasswordStrengthLabels;\n dangerConfirm: DangerConfirmLabels;\n swatchPicker: SwatchPickerLabels;\n iconPicker: IconPickerLabels;\n dialogFrame: DialogFrameLabels;\n filePicker: FilePickerLabels;\n measuredGrid: MeasuredGridLabels;\n feedbackAttachment: FeedbackAttachmentFieldLabels;\n /** 0.12.0: `FeedbackDialog`'s own strings; `FeedbackThread` / `FeedbackComposer`. */\n feedbackDialog: FeedbackDialogTextLabels;\n feedbackThread: FeedbackThreadLabels;\n feedbackComposer: FeedbackComposerLabels;\n /** 0.12.0: `ProfileSetting`, `PasswordSetting`, `TwoFactorSetting`, `PasskeysSetting`\n * — one record per section. The provider takes a whole section record; the\n * components merge it key by key, as a prop. */\n accountSettings: AccountSettingsLabels;\n confirmDialog: ConfirmDialogLabels;\n floatingPanel: FloatingPanelLabels;\n copyButton: CopyButtonLabels;\n bulkActionBar: BulkActionBarLabels;\n list: ListLabels;\n breadcrumbs: BreadcrumbsLabels;\n toast: ToastLabels;\n form: FormActionsLabels;\n descriptionList: DescriptionListLabels;\n lineItems: LineItemsLabels;\n progressBar: ProgressBarLabels;\n signedAmount: SignedAmountLabels;\n errorBoundary: ErrorBoundaryLabels;\n authedImage: AuthedImageLabels;\n imageGrid: ImageGridLabels;\n lightbox: LightboxLabels;\n}\n\n/**\n * A label override, as deep as the labels go: an object of labels (a namespace, or a\n * record inside one such as `accountSettings.passkeys` or `dataTable.presets`) may be\n * partial at every level, because the provider merges it key by key at every level.\n * A leaf stays as it is: a string, a function-valued label (`(n) => …`), and anything\n * that is not purely an object (a `ReactNode` union) is given whole.\n */\nexport type LabelOverride<T> = [T] extends [(...args: never[]) => unknown]\n ? T\n : [T] extends [readonly unknown[]]\n ? T\n : [T] extends [object]\n ? { [K in keyof T]?: LabelOverride<T[K]> }\n : T;\n\n/** Any subset of the tree — each namespace may be partial, and so may any record\n * inside one (`accountSettings.passkeys`, `dataTable.presets`): they are merged key\n * by key, at every depth. */\nexport type UiKitLabelOverrides = { [K in keyof UiKitLabels]?: LabelOverride<UiKitLabels[K]> };\n\n/* ── English defaults for the namespaces defined here ────────────────────── */\n\nexport const DEFAULT_COMMON_LABELS: CommonLabels = {\n close: \"Close\",\n clear: \"Clear\",\n search: \"Search\",\n done: \"Done\",\n cancel: \"Cancel\",\n save: \"Save\",\n back: \"Back\",\n next: \"Next\",\n remove: \"Remove\",\n loading: \"Loading…\",\n noResults: \"No results\",\n fieldValue: (field, value) => `${field}: ${value}`,\n dismiss: \"Dismiss\",\n opensInNewTab: \"opens in a new tab\",\n};\n\nexport const DEFAULT_DATE_PICKER_LABELS: DatePickerLabels = {\n panel: \"Choose a date\",\n rangePanel: \"Choose a date range\",\n clear: \"Clear\",\n previousDay: \"Previous day\",\n nextDay: \"Next day\",\n today: \"Today\",\n apply: \"Apply\",\n cancel: \"Cancel\",\n presets: \"Quick ranges\",\n};\n\nexport const DEFAULT_COMBOBOX_LABELS: ComboboxLabels = {\n search: \"Search\",\n noResults: \"No results\",\n clear: \"Clear\",\n loading: \"Loading…\",\n create: (query) => `Create “${query}”`,\n selectedCount: (count) => `${count} selected`,\n loadError: \"Couldn’t load results\",\n resultCount: (count) => (count === 1 ? \"1 result\" : `${count} results`),\n minChars: (count) =>\n count === 1 ? \"Type at least 1 character\" : `Type at least ${count} characters`,\n};\n\nexport const DEFAULT_MULTI_SELECT_LABELS: MultiSelectLabels = {\n search: \"Search\",\n selectAll: \"Select all\",\n clear: \"Clear\",\n all: \"All\",\n selectedCount: (count) => String(count),\n};\n\nexport const DEFAULT_CALCULATOR_LABELS: CalculatorLabels = {\n open: \"Open calculator\",\n panel: \"Calculator\",\n calculation: \"Calculation\",\n backspace: \"Backspace\",\n clear: \"Clear\",\n equals: \"Equals\",\n done: \"Done\",\n plus: \"Plus\",\n minus: \"Minus\",\n times: \"Times\",\n divide: \"Divide\",\n decimal: \"Decimal point\",\n};\n\nexport const DEFAULT_CURRENCY_LABELS: CurrencyLabels = {\n currency: \"Currency\",\n search: \"Search currency\",\n};\n\nexport const DEFAULT_APP_SHELL_LABELS: AppShellLabels = {\n collapse: \"Collapse sidebar\",\n expand: \"Expand sidebar\",\n toggleGroup: (groupLabel) => `${groupLabel}: pages`,\n};\n\nexport const DEFAULT_TOP_BAR_LABELS: TopBarLabels = {\n theme: \"Toggle theme\",\n palette: \"Appearance preset\",\n language: \"Language\",\n switchRole: \"Switch role\",\n role: (value) => `Role: ${value}`,\n};\n\nexport const DEFAULT_PICKER_SHEET_LABELS: PickerSheetLabels = { close: \"Close\" };\n\nexport const DEFAULT_SWIPEABLE_ROW_LABELS: SwipeableRowLabels = { actions: \"Row actions\" };\n\n/** Formats with the locale the provider was given (see {@link useKitFileLabels}).\n * This static default has no locale to hand and falls back to the runtime's. */\nexport const DEFAULT_FILE_LABELS: FileLabels = {\n size: (bytes) => formatFileSize(bytes),\n};\n\n/** \"12 kB\", \"3.4 MB\" — `Intl`'s unit formatting, so the digits, the decimal mark and\n * the unit's spelling all follow `locale`. */\nexport function formatFileSize(bytes: number, locale?: string): string {\n const units = [\"byte\", \"kilobyte\", \"megabyte\", \"gigabyte\"] as const;\n let value = bytes;\n let i = 0;\n while (value >= 1000 && i < units.length - 1) {\n value /= 1000;\n i += 1;\n }\n return new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: units[i],\n unitDisplay: i === 0 ? \"long\" : \"short\",\n maximumFractionDigits: value < 10 && i > 0 ? 1 : 0,\n }).format(value);\n}\n\n/* ── The provider ────────────────────────────────────────────────────────── */\n\ninterface KitI18n {\n labels?: UiKitLabelOverrides;\n locale?: string;\n weekStartsOn?: WeekDay;\n linkComponent?: KitLinkComponent;\n}\n\n/**\n * What every kit link receives: the anchor attributes the kit decided (href, class,\n * aria-current, handlers, children, ref). An app's router link maps them —\n * `({ href, ...p }) => <Link to={href} {...p} />` — ONCE, on the provider.\n */\nexport type KitLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n ref?: Ref<HTMLAnchorElement>;\n};\nexport type KitLinkComponent = (props: KitLinkProps) => ReactElement;\n\nconst KitI18nContext = createContext<KitI18n>({});\n\nexport interface UiKitProviderProps {\n /** Any part of {@link UiKitLabels}. Missing keys fall back to English. */\n labels?: UiKitLabelOverrides;\n /**\n * BCP 47 tag used by every kit component that formats something — dates, numbers,\n * month and weekday names, file sizes — when it is not handed a `locale` prop of\n * its own. Without a provider, and without a prop, those use the runtime default.\n */\n locale?: string;\n /**\n * The first day of the week (0 = Sunday, 1 = Monday …) for every calendar below —\n * `MiniCalendar` and the pickers built on it — that is not handed a `weekStartsOn`\n * of its own. Without it the week start follows `locale`'s week info.\n *\n * Separate from `locale` because the two are separate decisions: a German-built\n * app running in English (`locale=\"en\"`) would otherwise start its weeks on Sunday,\n * and switching it to `en-GB` to get Monday changes every date and number format.\n */\n weekStartsOn?: WeekDay;\n /**\n * The app's router link, used by every kit component that renders an in-app link\n * and was not handed its own `renderLink` — so `renderLink` stops being repeated on\n * each ListItem, Breadcrumbs, StatTile, Chip… (kastlan). A component's own\n * `renderLink` wins; external links and in-page `#anchor`s stay plain `<a>`, and a\n * hash-router `#/path` is handed to it like `/path` (see `pickLinkRenderer`).\n */\n linkComponent?: KitLinkComponent;\n children: ReactNode;\n}\n\n/**\n * Hand every kit component below this point its strings and its locale.\n *\n * Optional: a component outside any provider behaves exactly as it did before the\n * provider existed. Nesting works as a merge — an inner provider overrides only what\n * it names, so a page can re-label one table's `dataTable.table` without restating\n * the language.\n */\nexport function UiKitProvider({\n labels,\n locale,\n weekStartsOn,\n linkComponent,\n children,\n}: UiKitProviderProps) {\n const outer = useContext(KitI18nContext);\n const value = useMemo<KitI18n>(\n () => ({\n locale: locale ?? outer.locale,\n weekStartsOn: weekStartsOn ?? outer.weekStartsOn,\n labels: mergeOverrides(outer.labels, labels),\n linkComponent: linkComponent ?? outer.linkComponent,\n }),\n [outer, labels, locale, weekStartsOn, linkComponent],\n );\n return <KitI18nContext.Provider value={value}>{children}</KitI18nContext.Provider>;\n}\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/** A record of labels to merge into — not a React element, which is an object too but\n * is a label given whole. */\nfunction isLabelRecord(v: unknown): v is Record<string, unknown> {\n return isRecord(v) && !(\"$$typeof\" in v);\n}\n\n/** Merged key by key at EVERY depth — a namespace, a record inside it\n * (`accountSettings.passkeys`, `dataTable.presets`), and so on down — to match\n * {@link LabelOverride}. An `undefined` is skipped at every depth, so it never blanks\n * out what is under it. */\nfunction mergeNamespace<T extends object>(base: T, over: LabelOverride<T> | Partial<T> | undefined): T {\n if (!over) return base;\n const out = { ...base } as Record<string, unknown>;\n for (const [k, v] of Object.entries(over)) {\n if (v === undefined) continue;\n const prev = out[k];\n out[k] = isLabelRecord(prev) && isLabelRecord(v) ? mergeNamespace(prev, v) : v;\n }\n return out as T;\n}\n\nfunction mergeOverrides(\n a: UiKitLabelOverrides | undefined,\n b: UiKitLabelOverrides | undefined,\n): UiKitLabelOverrides | undefined {\n if (!a) return b;\n if (!b) return a;\n const out: Record<string, unknown> = { ...a };\n for (const [ns, v] of Object.entries(b)) {\n out[ns] = mergeNamespace((out[ns] as object | undefined) ?? {}, v as object);\n }\n return out as UiKitLabelOverrides;\n}\n\n/** What the nearest provider says about one namespace — `undefined` outside one.\n * For a component whose own resolver does more than a merge (the data table\n * derives `columnsCount` from `columns`): feed `{ ...overrides, ...props }` to it. */\nexport function useKitLabelOverrides<K extends keyof UiKitLabels>(\n ns: K,\n): Partial<UiKitLabels[K]> | undefined {\n return useContext(KitI18nContext).labels?.[ns] as Partial<UiKitLabels[K]> | undefined;\n}\n\n/**\n * One namespace, resolved: `defaults`, then the provider, then the component's own\n * `prop`. Record-valued keys are merged key by key at each step.\n */\nexport function useKitLabels<K extends keyof UiKitLabels>(\n ns: K,\n defaults: UiKitLabels[K],\n prop?: Partial<UiKitLabels[K]>,\n): UiKitLabels[K] {\n const fromProvider = useKitLabelOverrides(ns);\n return useMemo(\n () => mergeNamespace(mergeNamespace(defaults, fromProvider), prop),\n [defaults, fromProvider, prop],\n );\n}\n\n/** The component's own `locale` prop, else the provider's, else `undefined` (which\n * every `Intl` API reads as \"the runtime's default\"). */\nexport function useKitLocale(prop?: string): string | undefined {\n const fromProvider = useContext(KitI18nContext).locale;\n return prop ?? fromProvider;\n}\n\n/** The week start the nearest `<UiKitProvider weekStartsOn>` pins, else `undefined`\n * (the caller then asks the locale). A component's own prop goes first:\n * `prop ?? useKitWeekStart()`. */\n/** The provider's router link, or `undefined` — a component's own `renderLink` should\n * win over it: `const Link = renderLink ?? useKitLink()`. */\nexport function useKitLink(): KitLinkComponent | undefined {\n return useContext(KitI18nContext).linkComponent;\n}\n\nexport function useKitWeekStart(): WeekDay | undefined {\n return useContext(KitI18nContext).weekStartsOn;\n}\n\n/** {@link DEFAULT_FILE_LABELS}, but formatting in the provider's locale. */\nexport function useKitFileLabels(prop?: Partial<FileLabels>): FileLabels {\n const locale = useKitLocale();\n const defaults = useMemo<FileLabels>(\n () => ({ size: (bytes) => formatFileSize(bytes, locale) }),\n [locale],\n );\n return useKitLabels(\"file\", defaults, prop);\n}\n\n/**\n * The dot paths of every key `labels` does NOT supply — the ones a translated app is\n * still showing in English. Assert on it in the app's own test:\n *\n * expect(missingKitLabels(de)).toEqual([]);\n *\n * `reference` is the complete tree to check against — pass\n * {@link DEFAULT_UI_KIT_LABELS} (src/i18n/defaults.ts). It is a parameter rather than an import\n * because the defaults live beside their components, and this module is imported BY\n * those components.\n */\nexport function missingKitLabels(\n labels: UiKitLabelOverrides | undefined,\n reference: UiKitLabels,\n): string[] {\n const missing: string[] = [];\n for (const [ns, keys] of Object.entries(reference)) {\n const given = (labels as Record<string, Record<string, unknown> | undefined> | undefined)?.[ns];\n for (const [key, value] of Object.entries(keys as Record<string, unknown>)) {\n const got = given?.[key];\n if (got === undefined) {\n missing.push(`${ns}.${key}`);\n } else if (isRecord(value) && isRecord(got)) {\n for (const sub of Object.keys(value)) {\n if (got[sub] === undefined) missing.push(`${ns}.${key}.${sub}`);\n }\n }\n }\n }\n return missing;\n}\n"],"mappings":";AAyeS;AAzeT,SAAS,eAAe,YAAY,eAAe;AA4S5C,MAAM,wBAAsC;AAAA,EACjD,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAA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,MAAM,EAAE;AAAA,IACxD,CAAC,MAAM;AAAA,EACT;AACA,SAAO,aAAa,QAAQ,UAAU,IAAI;AAC5C;AAaO,SAAS,iBACd,QACA,WACU;AACV,QAAM,UAAoB,CAAC;AAC3B,aAAW,CAAC,IAAI,IAAI,KAAK,OAAO,QAAQ,SAAS,GAAG;AAClD,UAAM,QAAS,SAA6E,EAAE;AAC9F,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAA+B,GAAG;AAC1E,YAAM,MAAM,QAAQ,GAAG;AACvB,UAAI,QAAQ,QAAW;AACrB,gBAAQ,KAAK,GAAG,EAAE,IAAI,GAAG,EAAE;AAAA,MAC7B,WAAW,SAAS,KAAK,KAAK,SAAS,GAAG,GAAG;AAC3C,mBAAW,OAAO,OAAO,KAAK,KAAK,GAAG;AACpC,cAAI,IAAI,GAAG,MAAM,OAAW,SAAQ,KAAK,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;AAAA,QAChE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/i18n/kit-labels.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\nimport type { AnchorHTMLAttributes, ReactElement, Ref } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { DataTableLabels } from \"../components/data-table-labels\";\nimport type { MiniCalendarLabels, WeekDay } from \"../components/mini-calendar\";\nimport type { CalendarHeatmapLabels } from \"../components/calendar-heatmap\";\nimport type { PopoverLabels } from \"../components/popover\";\nimport type { ChipInputLabels } from \"../components/chip\";\nimport type { FieldSyncLabels } from \"../components/field-sync\";\nimport type { PasswordRevealLabels, TabsLabels } from \"../components/ui\";\nimport type { WizardLabels } from \"../wizard/types\";\nimport type { TourLabels } from \"../tour/tour\";\nimport type { CommandPaletteLabels } from \"../search/command-palette\";\nimport type { GlobalSearchLabels } from \"../search/global-search\";\nimport type { MonthPickerLabels } from \"../components/month-picker\";\nimport type { PageContentsLabels } from \"../components/page-contents\";\nimport type { SeriesChartLabels } from \"../components/series-chart-labels\";\nimport type { PieChartLabels } from \"../components/pie-chart-labels\";\nimport type { SparklineLabels } from \"../components/sparkline\";\nimport type { StatTileLabels } from \"../components/stat-tile\";\nimport type { SignaturePadLabels } from \"../components/signature-pad\";\nimport type { PasswordStrengthLabels } from \"../components/password-strength\";\nimport type { DangerConfirmLabels } from \"../components/danger-confirm\";\nimport type { SwatchPickerLabels } from \"../components/swatch-picker\";\nimport type { IconPickerLabels } from \"../components/icon-picker\";\nimport type { DialogFrameLabels } from \"../components/dialog-frame\";\nimport type { FilePickerLabels } from \"../components/file-button\";\nimport type { MeasuredGridLabels } from \"../components/measured-grid\";\nimport type { FeedbackAttachmentFieldLabels } from \"../feedback/feedback-attachment\";\nimport type { FeedbackDialogTextLabels } from \"../feedback/feedback-dialog\";\nimport type { FeedbackComposerLabels, FeedbackThreadLabels } from \"../feedback/feedback-thread\";\nimport type { AccountSettingsLabels } from \"../components/account-settings-labels\";\nimport type { ConfirmDialogLabels } from \"../components/confirm-dialog\";\nimport type { FloatingPanelLabels } from \"../components/floating-panel\";\nimport type { CopyButtonLabels } from \"../components/copy-button\";\nimport type { BulkActionBarLabels } from \"../components/bulk-action-bar\";\nimport type { ListLabels } from \"../components/list\";\nimport type { BreadcrumbsLabels } from \"../components/breadcrumbs\";\nimport type { ToastLabels } from \"../components/toast\";\nimport type { FormActionsLabels } from \"../components/form-actions\";\nimport type { DescriptionListLabels } from \"../components/description-list\";\nimport type { LineItemsLabels } from \"../components/line-items\";\nimport type { ProgressBarLabels } from \"../components/progress-bar\";\nimport type { SignedAmountLabels } from \"../components/signed-amount\";\nimport type { ErrorBoundaryLabels } from \"../components/error-boundary\";\nimport type { AuthedImageLabels } from \"../components/authed-image\";\nimport type { ImageGridLabels } from \"../components/image-grid\";\nimport type { LightboxLabels } from \"../components/lightbox\";\n\n/**\n * EVERY string the kit renders, as one typed tree — and an optional provider that\n * hands it to every component at once.\n *\n * WHY THIS EXISTS. The kit ships no catalogue and resolves no strings, and that stays\n * true: the app supplies every word. What was wrong was HOW it had to supply them —\n * one `labels` prop per component instance, under a different prop name per\n * component (`labels`, `calendarLabels`, `passwordLabels`, `clearLabel`,\n * `searchPlaceholder`, `ariaLabel` …). A translated app therefore rendered English\n * wherever one call site forgot one prop, and nothing told it so: a German showcase\n * still said \"Rows per page\", \"Collapse sidebar\" and \"Popover\" in seven languages.\n *\n * Now there is one key per string, addressed by a dot path (`dataTable.pageSize`,\n * `datePicker.today`), and three sources in a fixed order of precedence:\n *\n * the component's own prop > <UiKitProvider labels> > English default\n *\n * A consumer writes its translation ONCE, as a `UiKitLabels` (or a partial of it),\n * mounts `<UiKitProvider labels={…} locale={…}>` at the root, and every kit component\n * below speaks that language — including the ones nested inside other kit components\n * (the calendar inside the data table's date filter, the popover inside the date\n * picker), which no prop at the outer call site could reach before.\n *\n * Messages that carry a value are FUNCTIONS of that value, never a template to fill:\n * a number glued into an English sentence is untranslatable, because the grammar\n * around it moves with it in most languages.\n */\n\n/* ── Namespaces that had no labels type of their own ─────────────────────── */\n\n/** The words several components share. A component's own namespace wins over these\n * where both exist; these are what a new component reaches for first. */\nexport interface CommonLabels {\n close: string;\n clear: string;\n search: string;\n done: string;\n cancel: string;\n save: string;\n back: string;\n next: string;\n remove: string;\n loading: string;\n noResults: string;\n /** \"Name: value\" — how a field's accessible name is composed with its value.\n * A colon-and-space is not universal punctuation (French puts a space before\n * the colon, Chinese uses a full-width one). */\n fieldValue: (field: string, value: string) => string;\n /** The × that puts away a banner or a notice (`AlertBanner onDismiss`). Not `close`:\n * nothing opened, and \"Close\" on a banner reads as closing the page it sits on. */\n dismiss: string;\n /** Read after a link that opens a new tab (`<Button href external>`, TextLink):\n * nothing else tells a screen reader the page is about to change tabs. */\n opensInNewTab: string;\n}\n\n/** `DatePicker` / `DateRangePicker` chrome. The calendar inside has its own\n * namespace, `miniCalendar`. */\nexport interface DatePickerLabels {\n /** Accessible name of the popover panel the calendar opens in. */\n panel: string;\n /** The same, for `DateRangePicker`'s panel. */\n rangePanel: string;\n clear: string;\n previousDay: string;\n nextDay: string;\n today: string;\n /** `DateRangePicker commit=\"apply\"`: the button that commits the drafted range. */\n apply: string;\n /** …and the one that discards it. */\n cancel: string;\n /** Accessible name of `DateRangePicker`'s preset column. */\n presets: string;\n}\n\n/** The whole combobox family: `Combobox`, `EntityCombobox`,\n * `MultiEntityCombobox`, `InlineEntityCombobox`, `Autocomplete`. */\nexport interface ComboboxLabels {\n search: string;\n noResults: string;\n clear: string;\n loading: string;\n /** The \"add this\" row when free entry is allowed. */\n create: (query: string) => string;\n /** Trigger summary once more than one value is picked. */\n selectedCount: (count: number) => string;\n /** An async lookup (`loadOptions`) failed. */\n loadError: string;\n /** Announced (live region) when the list settles on `count` > 0 rows. */\n resultCount: (count: number) => string;\n /** The query is shorter than the `minChars` a lookup needs. */\n minChars: (count: number) => string;\n}\n\nexport interface MultiSelectLabels {\n search: string;\n selectAll: string;\n clear: string;\n /** Trigger text when nothing is picked, which a multi-select reads as \"all\". */\n all: string;\n /** Trigger summary once some (but not all) values are picked. The English\n * default is the bare count, which is what the trigger has always shown. */\n selectedCount: (count: number) => string;\n}\n\n/** `CalculatorButton` (desktop popover keypad) and `NumberPadSheet` (phone sheet). */\nexport interface CalculatorLabels {\n /** The button that opens the calculator. */\n open: string;\n /** The popover / sheet itself. */\n panel: string;\n calculation: string;\n backspace: string;\n clear: string;\n equals: string;\n /** The primary key of the phone pad — visible text, not an aria-label. */\n done: string;\n /** Names of the operator keys and the decimal key. Their glyphs are not names a\n * screen reader agrees on — \"÷\" is read as \"division sign\", \"divided by\" or\n * nothing at all depending on the reader — so each says what it does. */\n plus: string;\n minus: string;\n times: string;\n divide: string;\n decimal: string;\n}\n\n/** `CurrencySelect` and the currency half of `AmountInput`. */\nexport interface CurrencyLabels {\n currency: string;\n search: string;\n}\n\nexport interface AppShellLabels {\n collapse: string;\n expand: string;\n /** Accessible name of an inline group's disclosure button (`subNav=\"inline\"`). */\n toggleGroup: (groupLabel: string) => string;\n}\n\nexport interface TopBarLabels {\n theme: string;\n palette: string;\n language: string;\n switchRole: string;\n /** The role switcher's tooltip, given the active role's name. */\n role: (value: string) => string;\n}\n\nexport interface PickerSheetLabels {\n close: string;\n}\n\nexport interface SwipeableRowLabels {\n actions: string;\n}\n\nexport interface FileLabels {\n /** A file size for display, given its size in BYTES. The default uses\n * `Intl.NumberFormat`'s unit formatting in the provider's locale. */\n size: (bytes: number) => string;\n}\n\n/** The complete tree. `UiKitProvider` takes any partial of it. */\nexport interface UiKitLabels {\n common: CommonLabels;\n dataTable: DataTableLabels;\n miniCalendar: MiniCalendarLabels;\n calendarHeatmap: CalendarHeatmapLabels;\n datePicker: DatePickerLabels;\n monthPicker: MonthPickerLabels;\n popover: PopoverLabels;\n combobox: ComboboxLabels;\n multiSelect: MultiSelectLabels;\n calculator: CalculatorLabels;\n currency: CurrencyLabels;\n chipInput: ChipInputLabels;\n fieldSync: FieldSyncLabels;\n passwordReveal: PasswordRevealLabels;\n tabs: TabsLabels;\n appShell: AppShellLabels;\n pageContents: PageContentsLabels;\n topBar: TopBarLabels;\n pickerSheet: PickerSheetLabels;\n swipeableRow: SwipeableRowLabels;\n file: FileLabels;\n wizard: WizardLabels;\n tour: TourLabels;\n commandPalette: CommandPaletteLabels;\n globalSearch: GlobalSearchLabels;\n seriesChart: SeriesChartLabels;\n pieChart: PieChartLabels;\n sparkline: SparklineLabels;\n statTile: StatTileLabels;\n signaturePad: SignaturePadLabels;\n passwordStrength: PasswordStrengthLabels;\n dangerConfirm: DangerConfirmLabels;\n swatchPicker: SwatchPickerLabels;\n iconPicker: IconPickerLabels;\n dialogFrame: DialogFrameLabels;\n filePicker: FilePickerLabels;\n measuredGrid: MeasuredGridLabels;\n feedbackAttachment: FeedbackAttachmentFieldLabels;\n /** 0.12.0: `FeedbackDialog`'s own strings; `FeedbackThread` / `FeedbackComposer`. */\n feedbackDialog: FeedbackDialogTextLabels;\n feedbackThread: FeedbackThreadLabels;\n feedbackComposer: FeedbackComposerLabels;\n /** 0.12.0: `ProfileSetting`, `PasswordSetting`, `TwoFactorSetting`, `PasskeysSetting`\n * — one record per section. The provider takes a whole section record; the\n * components merge it key by key, as a prop. */\n accountSettings: AccountSettingsLabels;\n confirmDialog: ConfirmDialogLabels;\n floatingPanel: FloatingPanelLabels;\n copyButton: CopyButtonLabels;\n bulkActionBar: BulkActionBarLabels;\n list: ListLabels;\n breadcrumbs: BreadcrumbsLabels;\n toast: ToastLabels;\n form: FormActionsLabels;\n descriptionList: DescriptionListLabels;\n lineItems: LineItemsLabels;\n progressBar: ProgressBarLabels;\n signedAmount: SignedAmountLabels;\n errorBoundary: ErrorBoundaryLabels;\n authedImage: AuthedImageLabels;\n imageGrid: ImageGridLabels;\n lightbox: LightboxLabels;\n}\n\n/**\n * A label override, as deep as the labels go: an object of labels (a namespace, or a\n * record inside one such as `accountSettings.passkeys` or `dataTable.presets`) may be\n * partial at every level, because the provider merges it key by key at every level.\n * A leaf stays as it is: a string, a function-valued label (`(n) => …`), and anything\n * that is not purely an object (a `ReactNode` union) is given whole.\n */\nexport type LabelOverride<T> = [T] extends [(...args: never[]) => unknown]\n ? T\n : [T] extends [readonly unknown[]]\n ? T\n : [T] extends [object]\n ? { [K in keyof T]?: LabelOverride<T[K]> }\n : T;\n\n/** Any subset of the tree — each namespace may be partial, and so may any record\n * inside one (`accountSettings.passkeys`, `dataTable.presets`): they are merged key\n * by key, at every depth. */\nexport type UiKitLabelOverrides = { [K in keyof UiKitLabels]?: LabelOverride<UiKitLabels[K]> };\n\n/* ── English defaults for the namespaces defined here ────────────────────── */\n\nexport const DEFAULT_COMMON_LABELS: CommonLabels = {\n close: \"Close\",\n clear: \"Clear\",\n search: \"Search\",\n done: \"Done\",\n cancel: \"Cancel\",\n save: \"Save\",\n back: \"Back\",\n next: \"Next\",\n remove: \"Remove\",\n loading: \"Loading…\",\n noResults: \"No results\",\n fieldValue: (field, value) => `${field}: ${value}`,\n dismiss: \"Dismiss\",\n opensInNewTab: \"opens in a new tab\",\n};\n\nexport const DEFAULT_DATE_PICKER_LABELS: DatePickerLabels = {\n panel: \"Choose a date\",\n rangePanel: \"Choose a date range\",\n clear: \"Clear\",\n previousDay: \"Previous day\",\n nextDay: \"Next day\",\n today: \"Today\",\n apply: \"Apply\",\n cancel: \"Cancel\",\n presets: \"Quick ranges\",\n};\n\nexport const DEFAULT_COMBOBOX_LABELS: ComboboxLabels = {\n search: \"Search\",\n noResults: \"No results\",\n clear: \"Clear\",\n loading: \"Loading…\",\n create: (query) => `Create “${query}”`,\n selectedCount: (count) => `${count} selected`,\n loadError: \"Couldn’t load results\",\n resultCount: (count) => (count === 1 ? \"1 result\" : `${count} results`),\n minChars: (count) =>\n count === 1 ? \"Type at least 1 character\" : `Type at least ${count} characters`,\n};\n\nexport const DEFAULT_MULTI_SELECT_LABELS: MultiSelectLabels = {\n search: \"Search\",\n selectAll: \"Select all\",\n clear: \"Clear\",\n all: \"All\",\n selectedCount: (count) => String(count),\n};\n\nexport const DEFAULT_CALCULATOR_LABELS: CalculatorLabels = {\n open: \"Open calculator\",\n panel: \"Calculator\",\n calculation: \"Calculation\",\n backspace: \"Backspace\",\n clear: \"Clear\",\n equals: \"Equals\",\n done: \"Done\",\n plus: \"Plus\",\n minus: \"Minus\",\n times: \"Times\",\n divide: \"Divide\",\n decimal: \"Decimal point\",\n};\n\nexport const DEFAULT_CURRENCY_LABELS: CurrencyLabels = {\n currency: \"Currency\",\n search: \"Search currency\",\n};\n\nexport const DEFAULT_APP_SHELL_LABELS: AppShellLabels = {\n collapse: \"Collapse sidebar\",\n expand: \"Expand sidebar\",\n toggleGroup: (groupLabel) => `${groupLabel}: pages`,\n};\n\nexport const DEFAULT_TOP_BAR_LABELS: TopBarLabels = {\n theme: \"Toggle theme\",\n palette: \"Appearance preset\",\n language: \"Language\",\n switchRole: \"Switch role\",\n role: (value) => `Role: ${value}`,\n};\n\nexport const DEFAULT_PICKER_SHEET_LABELS: PickerSheetLabels = { close: \"Close\" };\n\nexport const DEFAULT_SWIPEABLE_ROW_LABELS: SwipeableRowLabels = { actions: \"Row actions\" };\n\n/** Formats with the locale the provider was given (see {@link useKitFileLabels}).\n * This static default has no locale to hand and falls back to the runtime's. */\nexport const DEFAULT_FILE_LABELS: FileLabels = {\n size: (bytes) => formatFileSize(bytes),\n};\n\n/** \"12 kB\", \"3.4 MB\" — `Intl`'s unit formatting, so the digits, the decimal mark and\n * the unit's spelling all follow `locale`. */\nexport function formatFileSize(bytes: number, locale?: string): string {\n const units = [\"byte\", \"kilobyte\", \"megabyte\", \"gigabyte\"] as const;\n let value = bytes;\n let i = 0;\n while (value >= 1000 && i < units.length - 1) {\n value /= 1000;\n i += 1;\n }\n return new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: units[i],\n unitDisplay: i === 0 ? \"long\" : \"short\",\n maximumFractionDigits: value < 10 && i > 0 ? 1 : 0,\n }).format(value);\n}\n\n/* ── The provider ────────────────────────────────────────────────────────── */\n\ninterface KitI18n {\n labels?: UiKitLabelOverrides;\n locale?: string;\n weekStartsOn?: WeekDay;\n linkComponent?: KitLinkComponent;\n}\n\n/**\n * What every kit link receives: the anchor attributes the kit decided (href, class,\n * aria-current, handlers, children, ref). An app's router link maps them —\n * `({ href, ...p }) => <Link to={href} {...p} />` — ONCE, on the provider.\n *\n * `replace` is the one prop that is not an anchor attribute: see there. Map it\n * explicitly if your router link is not react-router's —\n * `({ href, replace, ...p }) => <Link to={href} replace={replace} {...p} />` — and never\n * spread it onto a DOM `<a>`, where React warns about an unknown attribute.\n */\nexport type KitLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n ref?: Ref<HTMLAnchorElement>;\n /**\n * Navigate by REPLACING the current history entry, so Back skips it — keksdose F1:\n * a one-shot URL (a magic-link landing, `?checkout=done`, a wizard's \"finish\" hop)\n * that must not come back when the user presses Back. Present ONLY when the kit link\n * was given `replace` (`true`), so a provider link that spreads its props onto a\n * plain `<a>` keeps working for every link that never asks for it. react-router's\n * `<Link>` takes the same prop, so `({ href, ...p }) => <Link to={href} {...p} />`\n * honours it with no change; any other router maps it to its own replace option.\n * The kit never puts it on a DOM element itself.\n */\n replace?: boolean;\n};\nexport type KitLinkComponent = (props: KitLinkProps) => ReactElement;\n\nconst KitI18nContext = createContext<KitI18n>({});\n\nexport interface UiKitProviderProps {\n /** Any part of {@link UiKitLabels}. Missing keys fall back to English. */\n labels?: UiKitLabelOverrides;\n /**\n * BCP 47 tag used by every kit component that formats something — dates, numbers,\n * month and weekday names, file sizes — when it is not handed a `locale` prop of\n * its own. Without a provider, and without a prop, those use the runtime default.\n */\n locale?: string;\n /**\n * The first day of the week (0 = Sunday, 1 = Monday …) for every calendar below —\n * `MiniCalendar` and the pickers built on it — that is not handed a `weekStartsOn`\n * of its own. Without it the week start follows `locale`'s week info.\n *\n * Separate from `locale` because the two are separate decisions: a German-built\n * app running in English (`locale=\"en\"`) would otherwise start its weeks on Sunday,\n * and switching it to `en-GB` to get Monday changes every date and number format.\n */\n weekStartsOn?: WeekDay;\n /**\n * The app's router link, used by every kit component that renders an in-app link\n * and was not handed its own `renderLink` — so `renderLink` stops being repeated on\n * each ListItem, Breadcrumbs, StatTile, Chip… (kastlan). A component's own\n * `renderLink` wins; external links and in-page `#anchor`s stay plain `<a>`, and a\n * hash-router `#/path` is handed to it like `/path` (see `pickLinkRenderer`).\n */\n linkComponent?: KitLinkComponent;\n children: ReactNode;\n}\n\n/**\n * Hand every kit component below this point its strings and its locale.\n *\n * Optional: a component outside any provider behaves exactly as it did before the\n * provider existed. Nesting works as a merge — an inner provider overrides only what\n * it names, so a page can re-label one table's `dataTable.table` without restating\n * the language.\n */\nexport function UiKitProvider({\n labels,\n locale,\n weekStartsOn,\n linkComponent,\n children,\n}: UiKitProviderProps) {\n const outer = useContext(KitI18nContext);\n const value = useMemo<KitI18n>(\n () => ({\n locale: locale ?? outer.locale,\n weekStartsOn: weekStartsOn ?? outer.weekStartsOn,\n labels: mergeOverrides(outer.labels, labels),\n linkComponent: linkComponent ?? outer.linkComponent,\n }),\n [outer, labels, locale, weekStartsOn, linkComponent],\n );\n return <KitI18nContext.Provider value={value}>{children}</KitI18nContext.Provider>;\n}\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/** A record of labels to merge into — not a React element, which is an object too but\n * is a label given whole. */\nfunction isLabelRecord(v: unknown): v is Record<string, unknown> {\n return isRecord(v) && !(\"$$typeof\" in v);\n}\n\n/** Merged key by key at EVERY depth — a namespace, a record inside it\n * (`accountSettings.passkeys`, `dataTable.presets`), and so on down — to match\n * {@link LabelOverride}. An `undefined` is skipped at every depth, so it never blanks\n * out what is under it. */\nfunction mergeNamespace<T extends object>(base: T, over: LabelOverride<T> | Partial<T> | undefined): T {\n if (!over) return base;\n const out = { ...base } as Record<string, unknown>;\n for (const [k, v] of Object.entries(over)) {\n if (v === undefined) continue;\n const prev = out[k];\n out[k] = isLabelRecord(prev) && isLabelRecord(v) ? mergeNamespace(prev, v) : v;\n }\n return out as T;\n}\n\nfunction mergeOverrides(\n a: UiKitLabelOverrides | undefined,\n b: UiKitLabelOverrides | undefined,\n): UiKitLabelOverrides | undefined {\n if (!a) return b;\n if (!b) return a;\n const out: Record<string, unknown> = { ...a };\n for (const [ns, v] of Object.entries(b)) {\n out[ns] = mergeNamespace((out[ns] as object | undefined) ?? {}, v as object);\n }\n return out as UiKitLabelOverrides;\n}\n\n/** What the nearest provider says about one namespace — `undefined` outside one.\n * For a component whose own resolver does more than a merge (the data table\n * derives `columnsCount` from `columns`): feed `{ ...overrides, ...props }` to it. */\nexport function useKitLabelOverrides<K extends keyof UiKitLabels>(\n ns: K,\n): Partial<UiKitLabels[K]> | undefined {\n return useContext(KitI18nContext).labels?.[ns] as Partial<UiKitLabels[K]> | undefined;\n}\n\n/**\n * One namespace, resolved: `defaults`, then the provider, then the component's own\n * `prop`. Record-valued keys are merged key by key at each step.\n */\nexport function useKitLabels<K extends keyof UiKitLabels>(\n ns: K,\n defaults: UiKitLabels[K],\n prop?: Partial<UiKitLabels[K]>,\n): UiKitLabels[K] {\n const fromProvider = useKitLabelOverrides(ns);\n return useMemo(\n () => mergeNamespace(mergeNamespace(defaults, fromProvider), prop),\n [defaults, fromProvider, prop],\n );\n}\n\n/** The component's own `locale` prop, else the provider's, else `undefined` (which\n * every `Intl` API reads as \"the runtime's default\"). */\nexport function useKitLocale(prop?: string): string | undefined {\n const fromProvider = useContext(KitI18nContext).locale;\n return prop ?? fromProvider;\n}\n\n/** The week start the nearest `<UiKitProvider weekStartsOn>` pins, else `undefined`\n * (the caller then asks the locale). A component's own prop goes first:\n * `prop ?? useKitWeekStart()`. */\n/** The provider's router link, or `undefined` — a component's own `renderLink` should\n * win over it: `const Link = renderLink ?? useKitLink()`. */\nexport function useKitLink(): KitLinkComponent | undefined {\n return useContext(KitI18nContext).linkComponent;\n}\n\nexport function useKitWeekStart(): WeekDay | undefined {\n return useContext(KitI18nContext).weekStartsOn;\n}\n\n/** {@link DEFAULT_FILE_LABELS}, but formatting in the provider's locale. */\nexport function useKitFileLabels(prop?: Partial<FileLabels>): FileLabels {\n const locale = useKitLocale();\n const defaults = useMemo<FileLabels>(\n () => ({ size: (bytes) => formatFileSize(bytes, locale) }),\n [locale],\n );\n return useKitLabels(\"file\", defaults, prop);\n}\n\n/**\n * The dot paths of every key `labels` does NOT supply — the ones a translated app is\n * still showing in English. Assert on it in the app's own test:\n *\n * expect(missingKitLabels(de)).toEqual([]);\n *\n * `reference` is the complete tree to check against — pass\n * {@link DEFAULT_UI_KIT_LABELS} (src/i18n/defaults.ts). It is a parameter rather than an import\n * because the defaults live beside their components, and this module is imported BY\n * those components.\n */\nexport function missingKitLabels(\n labels: UiKitLabelOverrides | undefined,\n reference: UiKitLabels,\n): string[] {\n const missing: string[] = [];\n for (const [ns, keys] of Object.entries(reference)) {\n const given = (labels as Record<string, Record<string, unknown> | undefined> | undefined)?.[ns];\n for (const [key, value] of Object.entries(keys as Record<string, unknown>)) {\n const got = given?.[key];\n if (got === undefined) {\n missing.push(`${ns}.${key}`);\n } else if (isRecord(value) && isRecord(got)) {\n for (const sub of Object.keys(value)) {\n if (got[sub] === undefined) missing.push(`${ns}.${key}.${sub}`);\n }\n }\n }\n }\n return missing;\n}\n"],"mappings":";AAyfS;AAzfT,SAAS,eAAe,YAAY,eAAe;AA4S5C,MAAM,wBAAsC;AAAA,EACjD,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY,CAAC,OAAO,UAAU,GAAG,KAAK,KAAK,KAAK;AAAA,EAChD,SAAS;AAAA,EACT,eAAe;AACjB;AAEO,MAAM,6BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AACX;AAEO,MAAM,0BAA0C;AAAA,EACrD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ,CAAC,UAAU,gBAAW,KAAK;AAAA,EACnC,eAAe,CAAC,UAAU,GAAG,KAAK;AAAA,EAClC,WAAW;AAAA,EACX,aAAa,CAAC,UAAW,UAAU,IAAI,aAAa,GAAG,KAAK;AAAA,EAC5D,UAAU,CAAC,UACT,UAAU,IAAI,8BAA8B,iBAAiB,KAAK;AACtE;AAEO,MAAM,8BAAiD;AAAA,EAC5D,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,KAAK;AAAA,EACL,eAAe,CAAC,UAAU,OAAO,KAAK;AACxC;AAEO,M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zZHIF.js';
2
2
  import 'react';
3
3
  import '../../components/data-table-labels.js';
4
4
  import '../../components/mini-calendar.js';
@@ -1,4 +1,4 @@
1
- import { aT as UiKitLabels } from '../../kit-labels-v3biUF1L.js';
1
+ import { aV as UiKitLabels } from '../../kit-labels-Mz8zZHIF.js';
2
2
  import 'react';
3
3
  import '../../components/data-table-labels.js';
4
4
  import '../../components/mini-calendar.js';
@@ -1,4 +1,4 @@
1
- import { aT as UiKitLabels } from '../../kit-labels-v3biUF1L.js';
1
+ import { aV as UiKitLabels } from '../../kit-labels-Mz8zZHIF.js';
2
2
  import 'react';
3
3
  import '../../components/data-table-labels.js';
4
4
  import '../../components/mini-calendar.js';
@@ -1,4 +1,4 @@
1
- import { aT as UiKitLabels } from '../../kit-labels-v3biUF1L.js';
1
+ import { aV as UiKitLabels } from '../../kit-labels-Mz8zZHIF.js';
2
2
  import 'react';
3
3
  import '../../components/data-table-labels.js';
4
4
  import '../../components/mini-calendar.js';
@@ -526,7 +526,15 @@ function uiKitLabelsDe(numberLocale = "de-DE") {
526
526
  title: "Etwas ist schiefgelaufen",
527
527
  message: "Dieser Teil der Seite konnte nicht angezeigt werden. Bitte erneut versuchen oder die Seite neu laden.",
528
528
  retry: "Erneut versuchen",
529
- details: "Fehlerdetails"
529
+ details: "Fehlerdetails",
530
+ reload: "Neu laden",
531
+ updateTitle: "Eine neue Version ist verf\xFCgbar",
532
+ updateMessage: "Ein Teil der App hat sich seit dem Laden dieser Seite ge\xE4ndert. Zum Aktualisieren die Seite neu laden.",
533
+ offlineTitle: "Keine Internetverbindung",
534
+ offlineMessage: "Diese Seite konnte ohne Verbindung nicht geladen werden. Nach dem Wiederherstellen der Verbindung die Seite neu laden.",
535
+ copyReport: "Fehlerbericht kopieren",
536
+ reported: "Der Fehler wurde automatisch gemeldet.",
537
+ reportedAs: (reference) => `Gemeldet unter ${reference}`
530
538
  },
531
539
  authedImage: {
532
540
  loading: "Bild wird geladen\u2026",