@eifi1/ui-kit 0.24.1 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/chart.d.ts +2 -2
- package/dist/components/account-chips.d.ts +1 -1
- package/dist/components/amount-input.d.ts +2 -2
- package/dist/components/button-group.d.ts +2 -2
- package/dist/components/calculator.d.ts +2 -2
- package/dist/components/column-mapper.d.ts +28 -9
- package/dist/components/column-mapper.js +63 -77
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +2 -2
- package/dist/components/copy-button.d.ts +2 -2
- package/dist/components/danger-confirm.d.ts +2 -2
- package/dist/components/data-table-cells.d.ts +1 -1
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-labels.d.ts +1 -1
- package/dist/components/data-table-pagination.d.ts +1 -1
- package/dist/components/data-table-pagination.js +6 -1
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +7 -1
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/facing-pair.d.ts +2 -2
- package/dist/components/file-button.d.ts +2 -2
- package/dist/components/file-dropzone.d.ts +2 -2
- package/dist/components/form-actions.d.ts +2 -2
- package/dist/components/iban-input.d.ts +2 -2
- package/dist/components/language-select.d.ts +2 -2
- package/dist/components/money-field.d.ts +2 -2
- package/dist/components/number-field.d.ts +2 -2
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/numpad-sheet.d.ts +2 -2
- package/dist/components/phone-input.d.ts +2 -2
- package/dist/components/series-chart.d.ts +2 -2
- package/dist/components/settings-fields.d.ts +2 -2
- package/dist/components/share-card.d.ts +2 -2
- package/dist/components/swipeable-row.js +1 -1
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/table.d.ts +35 -1
- package/dist/components/table.js +4 -0
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +2 -2
- package/dist/components/time-input.d.ts +2 -2
- package/dist/components/tooltip.d.ts +103 -14
- package/dist/components/tooltip.js +194 -57
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/translation-review-editor.d.ts +9 -1
- package/dist/components/translation-review-editor.js +11 -1
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-labels.d.ts +10 -0
- package/dist/components/translation-review-labels.js +5 -1
- package/dist/components/translation-review-labels.js.map +1 -1
- package/dist/components/translation-review.d.ts +145 -8
- package/dist/components/translation-review.js +372 -91
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/ui.d.ts +2 -2
- package/dist/components/ui.js +55 -18
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/{data-table-labels-B7OdnM0S.d.ts → data-table-labels-Cdn1QS2k.d.ts} +21 -1
- package/dist/data-table.d.ts +1 -1
- package/dist/feedback/feedback-attachment.d.ts +2 -2
- package/dist/feedback/feedback-dialog.d.ts +2 -2
- package/dist/feedback/feedback-dialog.js +6 -1
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +2 -2
- package/dist/feedback/feedback-inbox.js +2 -0
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +2 -2
- package/dist/{feedback-DOwPu-Il.d.ts → feedback-BXKH-ToU.d.ts} +32 -3
- package/dist/feedback.d.ts +2 -2
- package/dist/hooks/use-body-scroll-lock.js +16 -0
- package/dist/hooks/use-body-scroll-lock.js.map +1 -1
- package/dist/hooks/use-file-drop.d.ts +2 -2
- package/dist/hooks/use-search-param-state.d.ts +58 -3
- package/dist/hooks/use-search-param-state.js +107 -35
- package/dist/hooks/use-search-param-state.js.map +1 -1
- package/dist/i18n/defaults.d.ts +2 -2
- package/dist/i18n/german.d.ts +2 -2
- package/dist/i18n/german.js +8 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +2 -2
- package/dist/i18n/languages.d.ts +2 -2
- package/dist/i18n/locales/de-CH.d.ts +2 -2
- package/dist/i18n/locales/en.d.ts +2 -2
- package/dist/i18n/locales/en.js +5 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +2 -2
- package/dist/i18n/locales/es.js +7 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +2 -2
- package/dist/i18n/locales/fr.js +6 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +2 -2
- package/dist/i18n/locales/hu.js +9 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +2 -2
- package/dist/i18n/locales/it.js +6 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +2 -2
- package/dist/i18n/locales/zh.js +6 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +2 -2
- package/dist/i18n/review.js +11 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/strip-fade.d.ts +84 -5
- package/dist/lib/strip-fade.js +109 -11
- package/dist/lib/strip-fade.js.map +1 -1
- package/dist/lib/translation-review.d.ts +45 -1
- package/dist/lib/translation-review.js +38 -1
- package/dist/lib/translation-review.js.map +1 -1
- package/dist/rhf/fields.d.ts +2 -2
- package/dist/rhf/form.d.ts +2 -2
- package/dist/rhf.d.ts +2 -2
- package/dist/shell/app-shell.d.ts +2 -2
- package/dist/shell/top-bar-brand.d.ts +2 -2
- package/dist/shell.d.ts +2 -2
- package/dist/wizard/stepper-nav.d.ts +2 -2
- package/dist/wizard.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/column-mapper.tsx +120 -113
- package/src/components/data-table-pagination.tsx +10 -1
- package/src/components/data-table.tsx +34 -1
- package/src/components/swipeable-row.tsx +1 -1
- package/src/components/table.tsx +39 -0
- package/src/components/tooltip.tsx +487 -104
- package/src/components/translation-review-editor.tsx +21 -1
- package/src/components/translation-review-labels.ts +17 -0
- package/src/components/translation-review.tsx +657 -109
- package/src/components/ui.tsx +104 -4
- package/src/feedback/feedback-dialog.tsx +21 -0
- package/src/feedback/feedback-inbox.tsx +19 -2
- package/src/hooks/use-body-scroll-lock.ts +25 -0
- package/src/hooks/use-search-param-state.ts +283 -41
- package/src/i18n/german.ts +10 -0
- package/src/i18n/locales/en.ts +7 -0
- package/src/i18n/locales/es.ts +9 -0
- package/src/i18n/locales/fr.ts +9 -0
- package/src/i18n/locales/hu.ts +11 -0
- package/src/i18n/locales/it.ts +9 -0
- package/src/i18n/locales/zh.ts +8 -0
- package/src/i18n/review.ts +11 -0
- package/src/index.ts +12 -0
- package/src/lib/strip-fade.ts +220 -15
- package/src/lib/translation-review.ts +85 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
import { useKitLabels } from "../i18n/kit-labels";
|
|
@@ -38,6 +38,14 @@ export interface TranslationReviewEditorProps {
|
|
|
38
38
|
onClose?: () => void;
|
|
39
39
|
/** Look, do not touch: a locale the viewer may read but not review. */
|
|
40
40
|
readOnly?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 0.25: put the cursor in the wording field when the editor opens, at the end of the
|
|
43
|
+
* text. The panel sets it when a phone card is swiped toward "Needs a change" (keksdose
|
|
44
|
+
* live #377): that swipe opens the editor to be written in, and a reviewer who has just
|
|
45
|
+
* said "this is wrong" should not have to find the field first. Not for an editor
|
|
46
|
+
* opened by a tap — that one may only be opened to read.
|
|
47
|
+
*/
|
|
48
|
+
focusWording?: boolean;
|
|
41
49
|
/** How the verdict's date reads. Default: the kit's `formatDate`, medium, in the
|
|
42
50
|
* provider's locale. */
|
|
43
51
|
formatDate?: (iso: string) => string;
|
|
@@ -85,6 +93,7 @@ export function TranslationReviewEditor({
|
|
|
85
93
|
onClear,
|
|
86
94
|
onClose,
|
|
87
95
|
readOnly = false,
|
|
96
|
+
focusWording = false,
|
|
88
97
|
formatDate: formatDateProp,
|
|
89
98
|
formatError,
|
|
90
99
|
className,
|
|
@@ -99,6 +108,16 @@ export function TranslationReviewEditor({
|
|
|
99
108
|
const [note, setNote] = useState(review?.note ?? "");
|
|
100
109
|
const [busy, setBusy] = useState<"approve" | "flag" | "clear" | null>(null);
|
|
101
110
|
const [failure, setFailure] = useState<ReactNode>(null);
|
|
111
|
+
const wordingRef = useRef<HTMLTextAreaElement>(null);
|
|
112
|
+
// On mount only: the prop says how the editor was OPENED, not where focus belongs
|
|
113
|
+
// for the rest of its life.
|
|
114
|
+
const focusOnOpen = useRef(focusWording && editable);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const field = wordingRef.current;
|
|
117
|
+
if (!focusOnOpen.current || !field) return;
|
|
118
|
+
field.focus();
|
|
119
|
+
field.setSelectionRange(field.value.length, field.value.length);
|
|
120
|
+
}, []);
|
|
102
121
|
|
|
103
122
|
const canFlag = note.trim() !== "" || suggestion.trim() !== row.text.trim();
|
|
104
123
|
const changed = row.status === "changed" ? review : null;
|
|
@@ -195,6 +214,7 @@ export function TranslationReviewEditor({
|
|
|
195
214
|
{editable && (
|
|
196
215
|
<>
|
|
197
216
|
<Textarea
|
|
217
|
+
ref={wordingRef}
|
|
198
218
|
label={missing ? labels.translation : labels.suggestion}
|
|
199
219
|
lang={row.locale}
|
|
200
220
|
rows={Math.min(8, Math.max(2, Math.ceil(Math.max(row.text.length, row.reference.length) / 80)))}
|
|
@@ -84,6 +84,16 @@ export interface TranslationReviewLabels {
|
|
|
84
84
|
exportCorrections: (count: number) => string;
|
|
85
85
|
/** A callback rejected and no `formatError` says better. */
|
|
86
86
|
failed: string;
|
|
87
|
+
/** 0.25: the Undo toast after an approval (`undo`) — one string, or a batch of them. */
|
|
88
|
+
approvedToast: (count: number) => string;
|
|
89
|
+
/** 0.25: a group's header under `groupBy` — how many of its rows nobody has read yet,
|
|
90
|
+
* of how many the filters show in it. */
|
|
91
|
+
groupCount: (unreviewed: number, total: number) => string;
|
|
92
|
+
/** 0.25: a group's bulk action — approve its unreviewed rows. */
|
|
93
|
+
approveGroup: (count: number) => string;
|
|
94
|
+
/** 0.25: asked first when a group's bulk approve is larger than a page — more than the
|
|
95
|
+
* reviewer can have had on screen. `group` is the group's name. */
|
|
96
|
+
confirmGroup: (count: number, group: string) => string;
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
export const DEFAULT_TRANSLATION_REVIEW_LABELS: TranslationReviewLabels = {
|
|
@@ -133,6 +143,13 @@ export const DEFAULT_TRANSLATION_REVIEW_LABELS: TranslationReviewLabels = {
|
|
|
133
143
|
scope: (areas) => `Your review is limited to: ${areas}.`,
|
|
134
144
|
exportCorrections: (count) => `Export corrections (${count})`,
|
|
135
145
|
failed: "That did not work. Please try again.",
|
|
146
|
+
approvedToast: (count) => (count === 1 ? "String approved" : `${count} strings approved`),
|
|
147
|
+
groupCount: (unreviewed, total) => `${unreviewed} unreviewed / ${total}`,
|
|
148
|
+
approveGroup: (count) => `Approve unreviewed (${count})`,
|
|
149
|
+
confirmGroup: (count, group) =>
|
|
150
|
+
count === 1
|
|
151
|
+
? `Approve the unreviewed string in ${group}?`
|
|
152
|
+
: `Approve all ${count} unreviewed strings in ${group}, including those not on screen?`,
|
|
136
153
|
};
|
|
137
154
|
|
|
138
155
|
/** A status's word, from the namespace's five. */
|