@cosmicdrift/kumiko-renderer 0.190.0 → 0.192.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.
- package/package.json +3 -3
- package/src/components/render-edit.tsx +36 -7
- package/src/components/render-field.tsx +1 -0
- package/src/i18n-defaults.ts +7 -0
- package/src/index.ts +1 -0
- package/src/primitives.tsx +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.192.0",
|
|
4
4
|
"description": "Platform-agnostic React renderer for Kumiko screens. Contains the shared logic — primitives-contract, hooks, KumikoScreen, navigation & SSE abstractions — that any platform-specific renderer (web, native) composes. No DOM, no EventSource, no react-dom.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
19
|
-
"@cosmicdrift/kumiko-headless": "0.
|
|
18
|
+
"@cosmicdrift/kumiko-framework": "0.192.0",
|
|
19
|
+
"@cosmicdrift/kumiko-headless": "0.192.0",
|
|
20
20
|
"react": "^19.2.6",
|
|
21
21
|
"temporal-polyfill": "^0.3.2",
|
|
22
22
|
"zod": "^4.4.3"
|
|
@@ -362,7 +362,8 @@ export function RenderEdit<TValues extends FormValues, TCtx = unknown>(
|
|
|
362
362
|
const [extensionErrorKey, setExtensionErrorKey] = useState<string | null>(null);
|
|
363
363
|
const { registry: extensionFormRegistry, runAll: runExtensionSubmits } =
|
|
364
364
|
useExtensionFormHost(setExtensionDirty);
|
|
365
|
-
const { Button, Banner, Dialog, Form, Section, Grid, GridCell, Text, Progress } =
|
|
365
|
+
const { Button, Banner, Dialog, Form, Section, Grid, GridCell, Text, Progress, StepBar } =
|
|
366
|
+
usePrimitives();
|
|
366
367
|
|
|
367
368
|
const fields = useMemo(() => deriveFormFields<TValues, TCtx>(screen), [screen]);
|
|
368
369
|
|
|
@@ -926,12 +927,40 @@ export function RenderEdit<TValues extends FormValues, TCtx = unknown>(
|
|
|
926
927
|
testId="render-edit-wizard-progress"
|
|
927
928
|
/>
|
|
928
929
|
)}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
930
|
+
{(() => {
|
|
931
|
+
const currentTitle = filteredSections[currentStep]?.title;
|
|
932
|
+
const compactLabel =
|
|
933
|
+
currentTitle !== undefined
|
|
934
|
+
? translate("kumiko.wizard.step-with-title", {
|
|
935
|
+
current: currentStep + 1,
|
|
936
|
+
total: lastStepIndex + 1,
|
|
937
|
+
title: currentTitle,
|
|
938
|
+
})
|
|
939
|
+
: translate("kumiko.wizard.step", {
|
|
940
|
+
current: currentStep + 1,
|
|
941
|
+
total: lastStepIndex + 1,
|
|
942
|
+
});
|
|
943
|
+
// No StepBar registered → keep the plain label RenderEdit
|
|
944
|
+
// always had (additive rollout, see CorePrimitives.StepBar).
|
|
945
|
+
if (StepBar === undefined) {
|
|
946
|
+
return (
|
|
947
|
+
<Text variant="small" testId="render-edit-wizard-step-label">
|
|
948
|
+
{compactLabel}
|
|
949
|
+
</Text>
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
return (
|
|
953
|
+
<StepBar
|
|
954
|
+
steps={filteredSections.map(
|
|
955
|
+
(section, sectionIndex) => section.title ?? String(sectionIndex + 1),
|
|
956
|
+
)}
|
|
957
|
+
currentIndex={currentStep}
|
|
958
|
+
compactLabel={compactLabel}
|
|
959
|
+
testId="render-edit-wizard-steps"
|
|
960
|
+
compactTestId="render-edit-wizard-step-label"
|
|
961
|
+
/>
|
|
962
|
+
);
|
|
963
|
+
})()}
|
|
935
964
|
</>
|
|
936
965
|
)}
|
|
937
966
|
{(isWizard ? filteredSections.filter((_, i) => i === currentStep) : filteredSections).map(
|
|
@@ -462,6 +462,7 @@ function renderInput({
|
|
|
462
462
|
{...(field.maxSize !== undefined && { maxSize: field.maxSize })}
|
|
463
463
|
{...(field.entityType !== undefined && { entityType: field.entityType })}
|
|
464
464
|
{...(field.fieldName !== undefined && { fieldName: field.fieldName })}
|
|
465
|
+
{...(field.imageVariant !== undefined && { imageVariant: field.imageVariant })}
|
|
465
466
|
/>
|
|
466
467
|
);
|
|
467
468
|
}
|
package/src/i18n-defaults.ts
CHANGED
|
@@ -28,6 +28,10 @@ export const kumikoDefaultTranslations: TranslationsByLocale = {
|
|
|
28
28
|
|
|
29
29
|
// Wizard step chrome (RenderEdit layout.mode="wizard").
|
|
30
30
|
"kumiko.wizard.step": "Schritt {current} von {total}",
|
|
31
|
+
"kumiko.wizard.step-with-title": "Schritt {current} von {total} · {title}",
|
|
32
|
+
|
|
33
|
+
// StepBar widget (renderer-web) — screen-reader text for completed steps whose number is visually replaced by a checkmark.
|
|
34
|
+
"kumiko.widget.stepBar.done": "Erledigt",
|
|
31
35
|
|
|
32
36
|
// Version — Update-Awareness-Banner (UpdateChecker).
|
|
33
37
|
"kumiko.version.update-available": "Eine neue Version ist verfügbar.",
|
|
@@ -205,6 +209,9 @@ export const kumikoDefaultTranslations: TranslationsByLocale = {
|
|
|
205
209
|
"kumiko.actions.finish": "Finish",
|
|
206
210
|
|
|
207
211
|
"kumiko.wizard.step": "Step {current} of {total}",
|
|
212
|
+
"kumiko.wizard.step-with-title": "Step {current} of {total} · {title}",
|
|
213
|
+
|
|
214
|
+
"kumiko.widget.stepBar.done": "Done",
|
|
208
215
|
|
|
209
216
|
"kumiko.version.update-available": "A new version is available.",
|
|
210
217
|
|
package/src/index.ts
CHANGED
package/src/primitives.tsx
CHANGED
|
@@ -264,6 +264,9 @@ export type InputProps =
|
|
|
264
264
|
* gegen die Field-Def von (entityType, fieldName). */
|
|
265
265
|
readonly entityType?: string;
|
|
266
266
|
readonly fieldName?: string;
|
|
267
|
+
/** Only for kind:"image" — variant name for the preview
|
|
268
|
+
* (`/api/files/:id/variant/:name`). Absent → the original. */
|
|
269
|
+
readonly imageVariant?: string;
|
|
267
270
|
}
|
|
268
271
|
| {
|
|
269
272
|
readonly kind: "date";
|
|
@@ -883,6 +886,21 @@ export type ProgressProps = {
|
|
|
883
886
|
readonly testId?: string;
|
|
884
887
|
};
|
|
885
888
|
|
|
889
|
+
/** Wizard step overview — numbered chips, one per step label, with the
|
|
890
|
+
* active step highlighted. Not clickable (step-jump validation is a
|
|
891
|
+
* separate concern, kumiko-framework#1966). Implementations render a
|
|
892
|
+
* narrow-viewport fallback showing `compactLabel` instead (caller
|
|
893
|
+
* supplies it pre-translated, e.g. "Step 2 of 5 · Industry") — which of
|
|
894
|
+
* the two is visible is a responsive layout choice owned by the
|
|
895
|
+
* implementation, not this contract. */
|
|
896
|
+
export type StepBarProps = {
|
|
897
|
+
readonly steps: readonly string[];
|
|
898
|
+
readonly currentIndex: number;
|
|
899
|
+
readonly compactLabel: string;
|
|
900
|
+
readonly testId?: string;
|
|
901
|
+
readonly compactTestId?: string;
|
|
902
|
+
};
|
|
903
|
+
|
|
886
904
|
// ---- Core-Registry (Kumiko-eigene Primitives) ----
|
|
887
905
|
|
|
888
906
|
export type CorePrimitives = {
|
|
@@ -912,6 +930,10 @@ export type CorePrimitives = {
|
|
|
912
930
|
* CorePrimitives mocks in tests keep compiling — additive rollout of
|
|
913
931
|
* a new primitive shouldn't force every test double to grow a stub. */
|
|
914
932
|
readonly Progress?: ComponentType<ProgressProps>;
|
|
933
|
+
/** Optional (unlike the other Core-Primitives) so existing partial
|
|
934
|
+
* CorePrimitives mocks in tests keep compiling — additive rollout of
|
|
935
|
+
* a new primitive shouldn't force every test double to grow a stub. */
|
|
936
|
+
readonly StepBar?: ComponentType<StepBarProps>;
|
|
915
937
|
};
|
|
916
938
|
|
|
917
939
|
/** Offene Extension-Zone für App-eigene Primitives. Devs erweitern
|